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


Commits:
95db8ff6 by Philipp Hörist at 2023-07-05T20:34:50+02:00
Fix some pyright errors

- - - - -


5 changed files:

- gajim/common/modules/moderations.py
- gajim/common/storage/archive/storage.py
- gajim/gtk/main.py
- pyproject.toml
- test/dialogs/conversation_view.py


Changes:

=====================================
gajim/common/modules/moderations.py
=====================================
@@ -114,6 +114,7 @@ def _insert_moderation_message(
             moderator_occupant_id = properties.moderation.occupant_id
 
         remote_jid = properties.remote_jid
+        assert remote_jid is not None
 
         fk_occupant_ek = None
         if moderator_occupant_id is not None:
@@ -161,6 +162,8 @@ def _insert_tombstone(
             message_occupant_id = properties.occupant_id
 
         remote_jid = properties.remote_jid
+        assert remote_jid is not None
+        assert properties.jid is not None
 
         fk_occupant_ek = None
         if message_occupant_id is not None:
@@ -202,6 +205,7 @@ def _insert_tombstone(
                 entitykey=entitykey))
 
     def _is_occupant_id_supported(self, properties: MessageProperties) -> bool:
+        assert properties.remote_jid is not None
         contact = self._client.get_module('Contacts').get_contact(
             properties.remote_jid, groupchat=True)
         return contact.supports(Namespace.OCCUPANT_ID)


=====================================
gajim/common/storage/archive/storage.py
=====================================
@@ -336,7 +336,8 @@ def get_last_conversation_row(self,
         stmt = f'''
             {GET_CONVERSATION_STMT}
             account_jid = ? AND
-            remote_jid = ?
+            remote_jid = ? AND
+            message_id IS NOT NULL
             ORDER BY message.timestamp DESC
         '''
         cursor = self._get_cursor(_messages_factory)


=====================================
gajim/gtk/main.py
=====================================
@@ -1110,11 +1110,13 @@ def mark_as_read(self,
         if last_message is None:
             return
 
+        assert last_message.message_id is not None
+
         client = app.get_client(account)
         contact = client.get_module('Contacts').get_contact(jid)
         assert isinstance(
             contact, BareContact | GroupchatContact | GroupchatParticipant)
-        # TODO: what if message_id is None?
+
         client.get_module('ChatMarkers').send_displayed_marker(
             contact,
             last_message.message_id,


=====================================
pyproject.toml
=====================================
@@ -136,6 +136,7 @@ include = [
     "gajim/common/modules/register.py",
     "gajim/common/modules/vcard4.py",
     "gajim/common/modules/vcard_temp.py",
+    "gajim/common/modules/moderations.py",
     "gajim/common/passwords.py",
     "gajim/common/preview_helpers.py",
     "gajim/common/regex.py",


=====================================
test/dialogs/conversation_view.py
=====================================
@@ -13,7 +13,7 @@
 from gajim.common.modules.contacts import ContactSettings
 from gajim.common.preview import PreviewManager
 from gajim.common.settings import Settings
-from gajim.common.storage.archive import MessageArchiveStorage
+from gajim.common.storage.archive.storage import MessageArchiveStorage
 from gajim.common.storage.events import EventStorage
 
 from gajim.gtk.avatar import generate_default_avatar



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

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