* Wire a posted message's `onReaction` to its returned id: cache it for this * process and, when it came from a component, persist a durable snapshot so a * reaction after a restart re-derives it (parity with a component `onClick`).
(
messageId: string,
bound: Awaited<ReturnType<Thread["bindForPost"]>>,
)
| 88 | * reaction after a restart re-derives it (parity with a component `onClick`). |
| 89 | */ |
| 90 | private async bindReaction( |
| 91 | messageId: string, |
| 92 | bound: Awaited<ReturnType<Thread["bindForPost"]>>, |
| 93 | ): Promise<void> { |
| 94 | if (bound.onReaction) { |
| 95 | this.deps.registry.registerMessageReaction(messageId, bound.onReaction); |
| 96 | } |
| 97 | if (bound.reactionComponent) { |
| 98 | await this.deps.registry.persistMessageReaction(messageId, { |
| 99 | ...bound.reactionComponent, |
| 100 | conversationKey: this.deps.conversationKey, |
| 101 | }); |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | async post(ui: Renderable): Promise<MessageRef> { |
| 106 | const bound = await this.bindForPost(ui); |
no test coverage detected