Improve message targeting for incoming reactions

This commit is contained in:
trevor-signal 2024-04-29 17:20:20 -04:00 committed by GitHub
parent f02a11bc9b
commit a0b4126b52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 769 additions and 180 deletions

View file

@ -220,12 +220,16 @@ export async function modifyTargetMessage(
}
// Does message message have any pending, previously-received associated reactions?
const reactions = Reactions.forMessage(message);
const reactions = Reactions.findReactionsForMessage(message);
log.info(
`${logId}: Found ${reactions.length} early reaction(s) for ${message.attributes.type} message`
);
await Promise.all(
reactions.map(async reaction => {
if (isStory(message.attributes)) {
// We don't set changed = true here, because we don't modify the original story
const generatedMessage = reaction.storyReactionMessage;
const generatedMessage = reaction.generatedMessageForStoryReaction;
strictAssert(
generatedMessage,
'Story reactions must provide storyReactionMessage'