Philipp Hörist pushed to branch master at gajim / gajim


Commits:
eefe12d0 by Philipp Hörist at 2025-08-07T23:00:46+02:00
fix: Reactions: Correctly count when reacting to own messages

- - - - -


2 changed files:

- gajim/common/modules/message.py
- gajim/common/storage/archive/models.py


Changes:

=====================================
gajim/common/modules/message.py
=====================================
@@ -388,17 +388,28 @@ def store_message(self, message: OutgoingMessage) -> None:
 
         if message.reaction_data is not None:
             reactions_id, reactions = message.reaction_data
-            reaction = mod.Reaction(
-                account_=self._account,
-                remote_jid_=remote_jid,
-                occupant_=occupant,
-                id=reactions_id,
-                direction=direction,
-                emojis=';'.join(reactions),
-                timestamp=message.timestamp,
-            )
+            if not reactions:
+                app.storage.archive.delete_reaction(
+                    account=self._account,
+                    jid=remote_jid,
+                    occupant_id=occupant.id if occupant is not None else None,
+                    reaction_id=reactions_id,
+                    direction=direction,
+                )
+                self._log.info('Delete own reactions for: %s', reactions_id)
+
+            else:
+                reaction = mod.Reaction(
+                    account_=self._account,
+                    remote_jid_=remote_jid,
+                    occupant_=occupant,
+                    id=reactions_id,
+                    direction=direction,
+                    emojis=';'.join(reactions),
+                    timestamp=message.timestamp,
+                )
 
-            app.storage.archive.upsert_row2(reaction)
+                app.storage.archive.upsert_row2(reaction)
 
             app.ged.raise_event(
                 ReactionUpdated(


=====================================
gajim/common/storage/archive/models.py
=====================================
@@ -932,7 +932,7 @@ def get_reactions(self) -> list[Reaction]:
         else:
             for message in itertools.chain([self], self.corrections):
                 for reaction in message.reactions:
-                    reactions[message.direction] = reaction
+                    reactions[reaction.direction] = reaction
 
         return list(reactions.values())
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/eefe12d02481abe6587759d875180d44e7a5ac42

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/eefe12d02481abe6587759d875180d44e7a5ac42
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to