|
|
|
@ -57,10 +57,8 @@ export function updateMutationCache(entry: SogsV3Mutation, seqno: number) {
|
|
|
|
|
} else {
|
|
|
|
|
const entryIndex = findIndex(sogsMutationCache, entry);
|
|
|
|
|
if (entryIndex >= 0) {
|
|
|
|
|
const updatedEntry = entry;
|
|
|
|
|
updatedEntry.seqno = seqno;
|
|
|
|
|
sogsMutationCache[entryIndex] = updatedEntry;
|
|
|
|
|
window.log.info('SOGS Mutation Cache: Entry updated!', updatedEntry);
|
|
|
|
|
sogsMutationCache[entryIndex].seqno = seqno;
|
|
|
|
|
window.log.info('SOGS Mutation Cache: Entry updated!', sogsMutationCache[entryIndex]);
|
|
|
|
|
} else {
|
|
|
|
|
window.log.error('SOGS Mutation Cache: Updated failed! Cannot find entry', entry);
|
|
|
|
|
}
|
|
|
|
@ -75,7 +73,6 @@ export async function processMessagesUsingCache(
|
|
|
|
|
const updatedReactions = message.reactions;
|
|
|
|
|
const roomMatches: Array<SogsV3Mutation> = filter(sogsMutationCache, { server, room });
|
|
|
|
|
|
|
|
|
|
if (roomMatches?.length) {
|
|
|
|
|
for (const roomMatch of roomMatches) {
|
|
|
|
|
if (message.seqno && roomMatch.seqno && roomMatch.seqno <= message.seqno) {
|
|
|
|
|
const removedEntry = remove(sogsMutationCache, roomMatch);
|
|
|
|
@ -94,7 +91,7 @@ export async function processMessagesUsingCache(
|
|
|
|
|
emoji: reaction,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
if (reactionMatches?.length) {
|
|
|
|
|
|
|
|
|
|
for (const reactionMatch of reactionMatches) {
|
|
|
|
|
switch (reactionMatch.metadata.action) {
|
|
|
|
|
case 'ADD':
|
|
|
|
@ -120,18 +117,13 @@ export async function processMessagesUsingCache(
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const removedMatches = remove(sogsMutationCache, ...roomMatches);
|
|
|
|
|
window.log.info(
|
|
|
|
|
'SOGS Mutation Cache: Removed processed entries from cache!',
|
|
|
|
|
removedMatches
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const removedMatches = remove(sogsMutationCache, ...roomMatches);
|
|
|
|
|
window.log.info('SOGS Mutation Cache: Removed processed entries from cache!', removedMatches);
|
|
|
|
|
|
|
|
|
|
message.reactions = updatedReactions;
|
|
|
|
|
await handleOpenGroupMessageReactions(message.reactions, message.id);
|
|
|
|
|
}
|
|
|
|
|