Philipp Hörist pushed to branch reaction-notifications at gajim / gajim


Commits:
29129f16 by Philipp Hörist at 2026-03-28T11:47:37+01:00
cfix: Select chat correctly on notification

- - - - -


3 changed files:

- gajim/gtk/activity_list.py
- gajim/gtk/chat_page.py
- gajim/gtk/main.py


Changes:

=====================================
gajim/gtk/activity_list.py
=====================================
@@ -818,14 +818,7 @@ def can_create(event: events.ReactionUpdated) -> bool:
 
     def activated(self) -> None:
         assert self.event.message is not None
-
-        message_type = MessageType(self.event.message.type).to_str()
-        app.window.add_chat(
-            self.event.account, self.event.jid, message_type, select=True
-        )
-
-        control = app.window.get_control()
-        control.scroll_to_message(self.event.message.pk, 
self.event.message.timestamp)
+        app.window.scroll_to_message(self.event.account, self.event.message)
 
     def should_notify(self) -> bool:
         if self.event.message is None:


=====================================
gajim/gtk/chat_page.py
=====================================
@@ -204,16 +204,16 @@ def show_workspace_chats(self, workspace_id: str) -> None:
         self._update_list_stack_header()
 
     def show_activity_page(self, context_id: str | None = None) -> None:
-        if context_id:
-            self._activity_list.select_with_context_id(context_id)
-        else:
-            self._activity_list.unselect()
-
         self._chat_list_header.set_label(_("Activity Feed"))
         self._chat_list_header.set_header_mode("activity")
         self._list_stack.set_visible_child_name("activity-list")
         self._chat_stack.show_activity_page(context_id)
 
+        if context_id:
+            self._activity_list.select_with_context_id(context_id)
+        else:
+            self._activity_list.unselect()
+
     def update_workspace(self, workspace_id: str) -> None:
         name = app.settings.get_workspace_setting(workspace_id, "name")
         self._chat_list_header.set_label(name)


=====================================
gajim/gtk/main.py
=====================================
@@ -35,6 +35,7 @@
 from gajim.common.modules.contacts import GroupchatParticipant
 from gajim.common.modules.contacts import ResourceContact
 from gajim.common.storage.archive.const import MessageType
+from gajim.common.storage.archive.models import Message
 from gajim.common.util.uri import InvalidUri
 from gajim.common.util.uri import XmppIri
 
@@ -1030,6 +1031,13 @@ def select_chat(self, account: str, jid: JID) -> None:
         self._main_stack.show_chat_page()
         self._chat_page.select_chat(account, jid)
 
+    def scroll_to_message(self, account: str, message: Message) -> None:
+        message_type = MessageType(message.type).to_str()
+        app.window.add_chat(account, message.remote.jid, message_type, 
select=True)
+
+        control = self._chat_page.get_control()
+        control.scroll_to_message(message.pk, message.timestamp)
+
     def select_next_chat(
         self, direction: Direction, unread_first: bool = False
     ) -> None:



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

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/29129f1670ab14bb47a163545f872365540578df
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