feat(platform): reaction.gossip span and toggle metadata (Phase 501)
Track hadMeBefore, added, gossipSent on reaction.toggle; emit reaction.gossip timing span when fanning out to guild mesh. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -59,6 +59,8 @@ Expose a single `EventEmitter` API the UI drives over IPC (`apps/pearcord/index.
|
|||||||
|
|
||||||
**v0.8.463 (Phase 500):** `message.send` `replyToId`; `message.edit` `deltaLength`; `message.delete` `hadReactions`/`reactionCount`. UI split messaging composer guild-loading compositor. Bundle: `npm run test:phase500-messaging`. See [MESSAGING.md](../../docs/MESSAGING.md).
|
**v0.8.463 (Phase 500):** `message.send` `replyToId`; `message.edit` `deltaLength`; `message.delete` `hadReactions`/`reactionCount`. UI split messaging composer guild-loading compositor. Bundle: `npm run test:phase500-messaging`. See [MESSAGING.md](../../docs/MESSAGING.md).
|
||||||
|
|
||||||
|
**v0.8.464 (Phase 501):** `reaction.toggle` `added`/`hadMeBefore`/`gossipSent`; `reaction.gossip` span on mesh fanout. UI `syncReactionPanelsDuringGuildLoading`. Bundle: `npm run test:phase501-reactions`. See [REACTIONS.md](../../docs/REACTIONS.md).
|
||||||
|
|
||||||
**v0.8.446 (Phase 483):** `guild.search` `includeMesh`/`queryLen`; `pin.list` `pinCount`. UI search compositor split + hints. Bundle: `npm run test:phase483-search`. See [SEARCH.md](../../docs/SEARCH.md).
|
**v0.8.446 (Phase 483):** `guild.search` `includeMesh`/`queryLen`; `pin.list` `pinCount`. UI search compositor split + hints. Bundle: `npm run test:phase483-search`. See [SEARCH.md](../../docs/SEARCH.md).
|
||||||
|
|
||||||
**v0.8.445 (Phase 482):** `message.send` `hasAttachment`/`hasSticker`; `message.edit` `contentChanged`; `message.delete` `wasOwn`. UI messaging compositor + hints. Bundle: `npm run test:phase482-messaging`. See [MESSAGING.md](../../docs/MESSAGING.md).
|
**v0.8.445 (Phase 482):** `message.send` `hasAttachment`/`hasSticker`; `message.edit` `contentChanged`; `message.delete` `wasOwn`. UI messaging compositor + hints. Bundle: `npm run test:phase482-messaging`. See [MESSAGING.md](../../docs/MESSAGING.md).
|
||||||
|
|||||||
@@ -11954,10 +11954,33 @@ class PearcordPlatform extends EventEmitter {
|
|||||||
const user = this.identity.user
|
const user = this.identity.user
|
||||||
if (!user) throw new Error('register first')
|
if (!user) throw new Error('register first')
|
||||||
if (this.mode === 'guild') await this._assertCanParticipate('reaction')
|
if (this.mode === 'guild') await this._assertCanParticipate('reaction')
|
||||||
const result = await this.messages.toggleReaction(messageId, emoji, user.id)
|
|
||||||
if (this.mode !== 'dm' && this.guild) this.guild.gossipReaction(result)
|
|
||||||
this.emit('reaction', result)
|
|
||||||
const emojiKey = String(emoji || '').slice(0, 16)
|
const emojiKey = String(emoji || '').slice(0, 16)
|
||||||
|
let hadMeBefore = false
|
||||||
|
try {
|
||||||
|
const priorRows = await this.messages.listReactions()
|
||||||
|
hadMeBefore = priorRows.some(
|
||||||
|
(r) =>
|
||||||
|
r.messageId === messageId && r.emoji === emojiKey && r.userId === user.id
|
||||||
|
)
|
||||||
|
} catch (_) {}
|
||||||
|
const result = await this.messages.toggleReaction(messageId, emoji, user.id)
|
||||||
|
let gossipSent = false
|
||||||
|
if (this.mode !== 'dm' && this.guild) {
|
||||||
|
const gossipSpan = this.log.time('reaction.gossip', {
|
||||||
|
messageId,
|
||||||
|
guildId,
|
||||||
|
channelId,
|
||||||
|
emoji: emojiKey
|
||||||
|
})
|
||||||
|
this.guild.gossipReaction(result)
|
||||||
|
gossipSpan.end({
|
||||||
|
removed: result?.removed === true,
|
||||||
|
guildId,
|
||||||
|
channelId
|
||||||
|
})
|
||||||
|
gossipSent = true
|
||||||
|
}
|
||||||
|
this.emit('reaction', result)
|
||||||
const reactionRows = await this.messages.listReactions()
|
const reactionRows = await this.messages.listReactions()
|
||||||
const reactionCount = reactionRows.filter(
|
const reactionCount = reactionRows.filter(
|
||||||
(r) => r.messageId === messageId && r.emoji === emojiKey
|
(r) => r.messageId === messageId && r.emoji === emojiKey
|
||||||
@@ -11969,6 +11992,9 @@ class PearcordPlatform extends EventEmitter {
|
|||||||
guildId,
|
guildId,
|
||||||
channelId,
|
channelId,
|
||||||
removed: result?.removed === true,
|
removed: result?.removed === true,
|
||||||
|
added: result?.removed !== true,
|
||||||
|
hadMeBefore,
|
||||||
|
gossipSent,
|
||||||
reactionCount
|
reactionCount
|
||||||
})
|
})
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user