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


Commits:
0450f874 by Philipp Hörist at 2025-09-28T10:17:14+02:00
cfix: Use fast method to delete all history for a contact

- - - - -


1 changed file:

- gajim/common/storage/archive/storage.py


Changes:

=====================================
gajim/common/storage/archive/storage.py
=====================================
@@ -1081,12 +1081,25 @@ def remove_history_for_jid(self, session: Session, 
account: str, jid: JID) -> No
         fk_account_pk = self._get_account_pk(session, account)
         fk_remote_pk = self._get_jid_pk(session, jid)
 
-        stmt = select(Message).where(
-            Message.fk_account_pk == fk_account_pk, Message.fk_remote_pk == 
fk_remote_pk
-        )
+        tables = [
+            MessageError,
+            Moderation,
+            Retraction,
+            Receipt,
+            DisplayedMarker,
+            Reaction,
+            Thread,
+            SecurityLabel,
+            Message,
+        ]
+
+        for table in tables:
+            stmt = delete(table).where(
+                table.fk_account_pk == fk_account_pk,
+                table.fk_remote_pk == fk_remote_pk,
+            )
 
-        for message in session.scalars(stmt).unique().all():
-            self._delete_message(session, message)
+            session.execute(stmt)
 
         log.info('Removed history for: %s', jid)
 



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

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