Add more logging for reactions handling

This commit is contained in:
Ken Powers 2020-02-07 18:12:47 -05:00 committed by GitHub
parent fba401aee8
commit f37e73c723
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -2222,8 +2222,11 @@
async handleReaction(reaction) {
const reactions = this.get('reactions') || [];
const messageId = this.idForLogging();
const count = reactions.length;
if (reaction.get('remove')) {
window.log.info('Removing reaction for message', messageId);
const newReactions = reactions.filter(
re =>
re.emoji !== reaction.get('emoji') ||
@ -2231,6 +2234,7 @@
);
this.set({ reactions: newReactions });
} else {
window.log.info('Adding reaction for message', messageId);
const newReactions = reactions.filter(
re => re.fromId !== reaction.get('fromId')
);
@ -2247,6 +2251,11 @@
}
}
const newCount = this.get('reactions').length;
window.log.info(
`Done processing reaction for message ${messageId}. Went from ${count} to ${newCount} reactions.`
);
await window.Signal.Data.saveMessage(this.attributes, {
Message: Whisper.Message,
});