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


Commits:
5c6f5f07 by Philipp Hörist at 2025-08-15T09:59:34+02:00
fix: Notifications: Don’t raise notification for messages from blocked users

Fixes #12315

- - - - -
c5e60f00 by Philipp Hörist at 2025-08-15T09:59:34+02:00
fix: ChatList: Don’t show messages from blocked users

Fixes #12386

- - - - -


3 changed files:

- gajim/common/storage/archive/storage.py
- gajim/gtk/chat_list.py
- gajim/gtk/notification.py


Changes:

=====================================
gajim/common/storage/archive/storage.py
=====================================
@@ -29,6 +29,7 @@
 from sqlalchemy.dialects.sqlite import insert
 from sqlalchemy.engine import Engine
 from sqlalchemy.exc import IntegrityError
+from sqlalchemy.orm import contains_eager
 from sqlalchemy.orm import joinedload
 from sqlalchemy.orm import Session
 
@@ -645,7 +646,10 @@ def get_last_conversation_row(
                 Message.fk_remote_pk == fk_remote_pk,
                 Message.fk_account_pk == fk_account_pk,
                 Message.correction_id.is_(None),
+                sa.or_(Occupant.blocked == sa.false(), 
Occupant.blocked.is_(None))
             )
+            .outerjoin(Occupant)
+            .options(contains_eager(Message.occupant))
             .order_by(sa.desc(Message.timestamp), sa.desc(Message.pk))
             .limit(1)
         )


=====================================
gajim/gtk/chat_list.py
=====================================
@@ -585,6 +585,13 @@ def _on_message_received(self, event: 
events.MessageReceived) -> None:
         if message.text is None:
             return
 
+        if message.type == MessageType.GROUPCHAT and message.occupant is not 
None:
+            client = app.get_client(event.account)
+            if client.get_module("MucBlocking").is_blocked(
+                message.remote.jid, message.occupant.id
+            ):
+                return
+
         assert message.id is not None
 
         nick = self._get_nick_for_received_message(event.account, message)


=====================================
gajim/gtk/notification.py
=====================================
@@ -99,6 +99,12 @@ def _on_notification(self, event: events.Notification) -> 
None:
                 log.debug("Notifications muted for %s", contact)
                 return
 
+            if isinstance(contact, GroupchatContact) and event.resource is not 
None:
+                participant = contact.get_resource(event.resource)
+                if participant.is_blocked:
+                    log.debug("Notifications blocked for %s", participant)
+                    return
+
         if event.sound is not None:
             play_sound(event.sound, event.account)
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/84d3c51bac3036df8e4395f94978cd9ed314e316...c5e60f00e85c0b8e8757f06cbb2f87266c565991

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/84d3c51bac3036df8e4395f94978cd9ed314e316...c5e60f00e85c0b8e8757f06cbb2f87266c565991
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