Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
dc02bdc8 by wurstsalat at 2022-09-18T19:16:05+02:00
fix: Corrections: Don’t correct message if text has not changed

Fixes #11146

- - - - -


2 changed files:

- gajim/gtk/chat_stack.py
- gajim/gtk/message_actions_box.py


Changes:

=====================================
gajim/gtk/chat_stack.py
=====================================
@@ -704,9 +704,23 @@ def _on_send_message(self) -> None:
 
         correct_id = None
         if self._message_action_box.is_correcting:
+            self._message_action_box.is_correcting = False
+            context = self._message_action_box.msg_textview.get_style_context()
+            context.remove_class('gajim-msg-correcting')
+
             correct_id = self._message_action_box.last_message_id.get(
                 (contact.account, contact.jid))
-            self._message_action_box.is_correcting = False
+            message_row = app.storage.archive.get_last_correctable_message(
+                contact.account, contact.jid, correct_id)
+            if message_row is None:
+                self._message_action_box.msg_textview.clear()
+                log.info('Trying to correct message older than threshold')
+                return
+
+            if message_row.message == message:
+                self._message_action_box.msg_textview.clear()
+                log.info('Trying to correct message with original text')
+                return
 
         chatstate = client.get_module('Chatstate').get_active_chatstate(
             contact)


=====================================
gajim/gtk/message_actions_box.py
=====================================
@@ -659,6 +659,3 @@ def _on_message_sent(self, event: events.MessageSent) -> 
None:
                 self.last_message_id[(account, jid)] = None
             else:
                 self.last_message_id[(account, jid)] = event.message_id
-
-        self.msg_textview.get_style_context().remove_class(
-            'gajim-msg-correcting')



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

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


_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to