diff --git a/nobilis b/nobilis index 9226c92..6c7be5a 160000 --- a/nobilis +++ b/nobilis @@ -1 +1 @@ -Subproject commit 9226c9231469a6d2a2945a29ecc3d14e2c650686 +Subproject commit 6c7be5a1f902f4e9fcdc32a933ca0e37bbf76cf5 diff --git a/src/renderer/src/state/store.ts b/src/renderer/src/state/store.ts index 8ffd54f..97d536e 100644 --- a/src/renderer/src/state/store.ts +++ b/src/renderer/src/state/store.ts @@ -705,6 +705,17 @@ export class ChatStore { this.handleBufferListChange(data) break + // Read on another device. Discord echoes an ack to every session an + // account has, including the one that sent it, so this settles our own + // count as well as following somebody's phone. + case 'bufferRead': + this.set({ + buffers: this.state.buffers.map((b) => + b.id === data.bufferId ? { ...b, unread: 0, highlight: false } : b + ) + }) + break + case 'bufferGroupChange': // A leave arrives as a removal rather than a new shape. Passing that // to the upsert would add a rail entry with no name and no service. @@ -1045,6 +1056,10 @@ export class ChatStore { } void window.moho.markBufferRead(bufferId) bestEffort(this.markRead(bufferId), 'mark read') + // And tell the service, where the service has anywhere to put it, so a + // conversation read here stops being unread on somebody's phone. A no-op + // on protocols with no read state, so it needs no test of which this is. + bestEffort(window.moho.rpc('markBufferRead', { bufferId }), 'ack read') bestEffort(window.moho.rpc('subscribe', { bufferId }), `subscribe ${bufferId}`) // Discord only sends a member list for the channel being looked at, and