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


Commits:
a9990c5c by Philipp Hörist at 2025-03-11T22:01:32+01:00
fix: Chat: Send read marker only when chat is at bottom

- - - - -


4 changed files:

- gajim/gtk/chat_list.py
- gajim/gtk/chat_stack.py
- gajim/gtk/control.py
- gajim/gtk/main.py


Changes:

=====================================
gajim/gtk/chat_list.py
=====================================
@@ -555,7 +555,7 @@ def _add_unread(row: ChatListRow, event: 
events.MessageReceived) -> None:
             return
 
         control = app.window.get_control()
-        if app.window.is_active() and row.is_selected() and 
control.get_autoscroll():
+        if app.window.is_active() and row.is_selected() and 
control.view_is_at_bottom():
             return
 
         assert message.text is not None


=====================================
gajim/gtk/chat_stack.py
=====================================
@@ -356,7 +356,10 @@ def _on_message_received(self, event: 
events.MessageReceived) -> None:
         if event.from_mam:
             return
 
-        if app.window.is_chat_active(event.account, event.jid):
+        if (
+            app.window.is_chat_active(event.account, event.jid)
+            and self._chat_control.view_is_at_bottom()
+        ):
             if event.message.id is None:
                 return
 


=====================================
gajim/gtk/control.py
=====================================
@@ -174,7 +174,7 @@ def remove_message(self, pk: int) -> None:
     def reset_view(self) -> None:
         self._scrolled_view.reset()
 
-    def get_autoscroll(self) -> bool:
+    def view_is_at_bottom(self) -> bool:
         return self._scrolled_view.get_autoscroll()
 
     def scroll_to_message(self, pk: int, timestamp: dt.datetime) -> None:
@@ -500,7 +500,7 @@ def _add_message(self, message: Message) -> None:
         if self._allow_add_message():
             self._scrolled_view.add_message_from_db(message)
 
-            if not self._scrolled_view.get_autoscroll():
+            if not self.view_is_at_bottom():
                 if message.direction == ChatDirection.OUTGOING:
                     self._scrolled_view.scroll_to_end()
                 else:


=====================================
gajim/gtk/main.py
=====================================
@@ -1152,7 +1152,6 @@ def mark_as_read(self, account: str, jid: JID, 
send_marker: bool = True) -> None
         )
 
     def _on_window_active(self, window: Gtk.ApplicationWindow, _param: Any) -> 
None:
-
         if not window.is_active():
             return
 
@@ -1161,7 +1160,7 @@ def _on_window_active(self, window: 
Gtk.ApplicationWindow, _param: Any) -> None:
         if not control.has_active_chat():
             return
 
-        if control.get_autoscroll():
+        if control.view_is_at_bottom():
             self.mark_as_read(control.contact.account, control.contact.jid)
 
     def get_preferred_ft_method(self, contact: types.ChatContactT) -> str | 
None:



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

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