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:
Raven Scott
2026-05-23 19:59:54 -04:00
co-authored by Cursor
parent 236e7ca451
commit 159e584853
2 changed files with 15 additions and 6 deletions
+6 -4
View File
@@ -48,7 +48,7 @@ Returns `false` for unknown types (caller may log).
| Boosts / stickers | `contribute-guild-boost`, `upsert-guild-sticker`, `upsert-sticker-pack` |
| Profile | `update-profile-cosmetics`, `set-profile-banner-image`, step-up PIN types |
| Voice / screen | `join-voice`, `join-voice-listen`, `join-stage`, `voice-capture-chunk`, `display-capture-frame` |
| Notifications | `mark-all-notifications-read` (emits `mark-all-notifications-read-cleared`, v0.8.283), `mark-notification-read` (emits `mark-notification-read-cleared` + `notificationChannelId`, v0.8.286), `mark-channel-read` (emits `mark-channel-read-cleared` + `threadChannelId` for threads, v0.8.287), `refresh-notifications` (v0.8.236) |
| Notifications | `mark-all-notifications-read` (emits `mark-all-notifications-read-cleared` + `composer-focus-channel`, v0.8.407), `mark-notification-read` (calls `platform.markNotificationRead`, emits `mark-notification-read-cleared` + `notificationChannelId`, v0.8.407), `open-notification` (marks read via `markNotificationRead`, emits `composer-focus-channel`, v0.8.407), `mark-channel-read` (emits `mark-channel-read-cleared` + `threadChannelId` for threads, v0.8.287), `refresh-notifications` (v0.8.236) |
| Workers | `export-integration-worker-script`, `run-worker-install-trial`, `announce-worker-release` |
| Moderation / channels | `ban-member`, `upsert-channel-overwrite`, forum/thread types |
| Search | `update-search`, `refresh-search`, `remove-search-recent` (v0.8.140) |
@@ -108,15 +108,17 @@ await dispatchUiMessage(
**v0.8.174:** `update-guild-settings` IPC forwards `nsfwGateEnabled` to `platform.updateGuildSettings`.
## Composer focus channel (v0.8.406)
## Composer focus channel (v0.8.406+)
After `create-thread` or `create-forum-post`, dispatch emits a sidecar event (not a full IPC round-trip from the UI):
After `create-thread`, `create-forum-post`, `mark-all-notifications-read`, or `open-notification`, dispatch emits a sidecar event (not a full IPC round-trip from the UI):
```javascript
send({ type: 'composer-focus-channel', channelId: thread.id })
// mark-all: channelId = platform.activeChannelId
// open-notification: channelId = result.channelId || msg.channelId || platform.activeChannelId
```
The renderer handles `composer-focus-channel` and calls `requestComposerAutofocusForChannel(channelId)` so the message box focuses once the new thread/post channel is active. Smoke: `test:composer-autofocus-after-thread-create`. See [MESSAGE_THREADS.md](../../docs/MESSAGE_THREADS.md) and [FORUM_CHANNELS.md](../../docs/FORUM_CHANNELS.md).
The renderer handles `composer-focus-channel` and calls `requestComposerAutofocusForChannel(channelId)` so the message box focuses once the target channel is active. Smokes: `test:composer-autofocus-after-thread-create`, `test:composer-autofocus-after-mark-all-notif`, `test:composer-autofocus-after-notif-navigate`. See [NOTIFICATIONS.md](../../docs/NOTIFICATIONS.md), [MESSAGE_THREADS.md](../../docs/MESSAGE_THREADS.md), and [FORUM_CHANNELS.md](../../docs/FORUM_CHANNELS.md).
## Maintenance
+9 -2
View File
@@ -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') {