diff --git a/src/modules/actions/apiUpdaters/messages.ts b/src/modules/actions/apiUpdaters/messages.ts index 663623ff9..2b602f0a5 100644 --- a/src/modules/actions/apiUpdaters/messages.ts +++ b/src/modules/actions/apiUpdaters/messages.ts @@ -491,7 +491,7 @@ addReducer('apiUpdate', (global, actions, update: ApiUpdate) => { } // Only notify about added reactions, not removed ones - const shouldNotify = checkIfReactionAdded(currentReactions, reactions); + const shouldNotify = checkIfReactionAdded(currentReactions, reactions, global.currentUserId); global = updateChatMessage(global, chatId, id, { reactions: update.reactions }); diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts index fab8385b1..413aa7766 100644 --- a/src/modules/helpers/index.ts +++ b/src/modules/helpers/index.ts @@ -5,4 +5,4 @@ export * from './messageSummary'; export * from './messageMedia'; export * from './localSearch'; export * from './payments'; -export { getMessageRecentReaction } from './reactions'; +export * from './reactions'; diff --git a/src/modules/helpers/reactions.ts b/src/modules/helpers/reactions.ts index 1f35d2d8f..06b6fae39 100644 --- a/src/modules/helpers/reactions.ts +++ b/src/modules/helpers/reactions.ts @@ -4,9 +4,11 @@ export function getMessageRecentReaction(message: Partial) { return message.isOutgoing ? message.reactions?.recentReactions?.[0] : undefined; } -export function checkIfReactionAdded(oldReactions?: ApiReactions, newReactions?: ApiReactions) { +export function checkIfReactionAdded(oldReactions?: ApiReactions, newReactions?: ApiReactions, currentUserId?: string) { if (!oldReactions || !oldReactions.recentReactions) return true; if (!newReactions || !newReactions.recentReactions) return false; + // Skip reactions from yourself + if (newReactions.recentReactions.every(reaction => reaction.userId === currentUserId)) return false; const oldReactionsMap = oldReactions.results.reduce>((acc, reaction) => { acc[reaction.reaction] = reaction.count; return acc;