feat(ui-flow): composer focus after notif actions (Phase 444)
Route mark-notification-read through platform.markNotificationRead. Send composer-focus-channel after mark-all and open-notification. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -773,7 +773,7 @@ async function dispatchUiMessage (platform, msg, hooks = {}) {
|
||||
return true
|
||||
}
|
||||
if (t === 'mark-notification-read') {
|
||||
const row = await platform.notifications?.markRead(msg.notificationId)
|
||||
const row = await platform.markNotificationRead(msg.notificationId)
|
||||
pushState()
|
||||
if (row?.channelId) {
|
||||
let dismissChannelId = row.channelId
|
||||
@@ -791,7 +791,7 @@ async function dispatchUiMessage (platform, msg, hooks = {}) {
|
||||
}
|
||||
if (t === 'open-notification') {
|
||||
if (msg.notificationId) {
|
||||
await platform.notifications?.markRead(msg.notificationId)
|
||||
await platform.markNotificationRead(msg.notificationId)
|
||||
}
|
||||
const result = await platform.openNotificationTarget({
|
||||
guildId: msg.guildId,
|
||||
@@ -799,6 +799,10 @@ async function dispatchUiMessage (platform, msg, hooks = {}) {
|
||||
messageId: msg.messageId
|
||||
})
|
||||
pushState()
|
||||
const focusChannelId = result?.channelId || msg.channelId || platform.activeChannelId
|
||||
if (focusChannelId) {
|
||||
send({ type: 'composer-focus-channel', channelId: focusChannelId })
|
||||
}
|
||||
send({
|
||||
type: 'open-notification-opened',
|
||||
guildId: msg.guildId || platform.guild?.guild?.id || null,
|
||||
@@ -1485,6 +1489,9 @@ async function dispatchUiMessage (platform, msg, hooks = {}) {
|
||||
await platform.markAllNotificationsRead()
|
||||
pushState()
|
||||
send({ type: 'mark-all-notifications-read-cleared' })
|
||||
if (platform.activeChannelId) {
|
||||
send({ type: 'composer-focus-channel', channelId: platform.activeChannelId })
|
||||
}
|
||||
return true
|
||||
}
|
||||
if (t === 'refresh-notifications') {
|
||||
|
||||
Reference in New Issue
Block a user