Skip to content

Commit 836ae4c

Browse files
authored
fix: don't drop role_mentions when hydrating messages (#181)
`hydrateInternal` resolves incoming payload keys using `keyMapping[key] ?? key` before invoking `functions[targetKey]`. Because `keyMapping` included entries for `mentions` and `replies` but missed `role_mentions`, the target key remained as its raw API string (`role_mentions`). Since no matching handler function existed under that name, it threw an error that was silently caught and logged as "Skipping key ... during hydration!". Because of this missing mapping, `roleMentionIds` was never populated during hydration and its extractor function went completely unused. Any code relying on it received `undefined`. Specifically, `Message.mentioned` checks `roleMentions?.some((role) => role.assigned)`, which meant it could never return true for role-based mentions. Adding `role_mentions` to the key mapping allows the existing extractor function to run as intended. Signed-off-by: Aki <aki@akiworks.xyz>
1 parent e90a149 commit 836ae4c

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/hydration/message.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export const messageHydration: Hydrate<Merge<Message>, HydratedMessage> = {
4040
system: "systemMessage",
4141
edited: "editedAt",
4242
mentions: "mentionIds",
43+
role_mentions: "roleMentionIds",
4344
replies: "replyIds",
4445
},
4546
functions: {

0 commit comments

Comments
 (0)