fix: make sure to clear a reaction is the count is 0 on an opengroup

pull/2454/head
William Grant 3 years ago
parent f138ea31b2
commit 58e4b4e896

@ -38,13 +38,10 @@ export function getMutationCache() {
function verifyEntry(entry: SogsV3Mutation): boolean {
return Boolean(
entry.server &&
entry.server !== '' &&
entry.room &&
entry.room !== '' &&
entry.changeType === ChangeType.REACTIONS &&
entry.metadata.messageId &&
entry.metadata.emoji &&
entry.metadata.emoji !== '' &&
(entry.metadata.action === 'ADD' ||
entry.metadata.action === 'REMOVE' ||
entry.metadata.action === 'CLEAR')

@ -317,12 +317,17 @@ const handleOpenGroupMessageReactions = async (
senders.push(reactor);
});
reacts[emoji] = {
count: reactions[key].count,
index: reactions[key].index,
senders,
you,
};
if (reactions[key].count > 0) {
reacts[emoji] = {
count: reactions[key].count,
index: reactions[key].index,
senders,
you,
};
} else {
// tslint:disable-next-line: no-dynamic-delete
delete reacts[key];
}
});
originalMessage.set({

Loading…
Cancel
Save