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


Commits:
7a3a6822 by wurstsalat at 2022-05-18T19:30:01+02:00
fix: Don't fail when trying to remove chat history

A group chat from bookmarks could have no history at all,
because Gajim never joined it in the past.

Fixes #10880

- - - - -


1 changed file:

- gajim/common/storage/archive.py


Changes:

=====================================
gajim/common/storage/archive.py
=====================================
@@ -1384,7 +1384,11 @@ def remove_history(self, account: str, jid: JID) -> None:
         If it's a group chat, remove last MAM ID as well.
         """
         account_id = self.get_account_id(account)
-        jid_id = self.get_jid_id(jid)
+        try:
+            jid_id = self.get_jid_id(jid)
+        except ValueError:
+            log.info('No history entries for: %s', jid)
+            return
         sql = 'DELETE FROM logs WHERE account_id = ? AND jid_id = ?'
         self._con.execute(sql, (account_id, jid_id))
 
@@ -1392,7 +1396,11 @@ def remove_history(self, account: str, jid: JID) -> None:
         log.info('Removed history for: %s', jid)
 
     def forget_jid_data(self, account: str, jid: JID) -> None:
-        jid_id = self.get_jid_id(jid)
+        try:
+            jid_id = self.get_jid_id(jid)
+        except ValueError:
+            log.info('No history entries for: %s', jid)
+            return
         sql = 'DELETE FROM jids WHERE jid_id = ?'
         self._con.execute(sql, (jid_id,))
 



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

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


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to