Philipp Hörist pushed to branch storage at gajim / gajim
Commits:
d24d87d4 by Philipp Hörist at 2024-03-23T10:52:41+01:00
fix: Fix pyright errors
- - - - -
5 changed files:
- gajim/common/storage/archive/models.py
- gajim/common/storage/archive/storage.py
- gajim/gtk/groupchat_nick_completion.py
- gajim/gtk/message_input.py
- gajim/gtk/search_view.py
Changes:
=====================================
gajim/common/storage/archive/models.py
=====================================
@@ -16,7 +16,6 @@
from sqlalchemy import Select
from sqlalchemy import select
from sqlalchemy import types
-from sqlalchemy import update
from sqlalchemy.orm import DeclarativeBase
from sqlalchemy.orm import Mapped
from sqlalchemy.orm import mapped_column
=====================================
gajim/common/storage/archive/storage.py
=====================================
@@ -655,7 +655,10 @@ def get_first_message_meta_for_date(
)
self._explain(session, stmt)
- return session.execute(stmt).one_or_none()
+ result = session.execute(stmt).one_or_none()
+ if result is None:
+ return None
+ return result.pk, result.timestamp
def date_has_history(self, account: str, jid: JID, date: dt.date) -> bool:
return self.get_first_message_meta_for_date(account, jid, date) is not
None
=====================================
gajim/gtk/groupchat_nick_completion.py
=====================================
@@ -130,7 +130,7 @@ def _nick_matching(nick: str) -> bool:
# Get recent nicknames from DB. This enables us to suggest
# nicknames even if no message arrived since Gajim was started.
recent_nicknames = app.storage.archive.get_recent_muc_nicks(
- self._contact)
+ self._contact.account, self._contact.jid)
matches: list[str] = []
for nick in recent_nicknames:
=====================================
gajim/gtk/message_input.py
=====================================
@@ -124,14 +124,17 @@ def toggle_message_correction(self) -> None:
if last_message_id is None:
return
- message_row = app.storage.archive.get_last_correctable_message(
+ message = app.storage.archive.get_last_correctable_message(
self._contact.account, self._contact.jid, last_message_id)
- if message_row is None or message_row.text is None:
+ if message is None or message.text is None:
return
- text = message_row.text
- if message_row.corrections:
- text = message_row.get_last_correction().text
+ text = message.text
+ if message.corrections:
+ text = message.get_last_correction().text
+
+ assert text is not None
+
self._set_correcting(True)
self.get_style_context().add_class('gajim-msg-correcting')
self.insert_text(text)
@@ -144,6 +147,8 @@ def try_message_correction(self, message: str) -> str |
None:
self.toggle_message_correction()
correct_id = self._last_message_id.get(self._contact)
+ if correct_id is None:
+ return None
message_row = app.storage.archive.get_last_correctable_message(
self._contact.account, self._contact.jid, correct_id)
if message_row is None:
=====================================
gajim/gtk/search_view.py
=====================================
@@ -314,8 +314,8 @@ def _scroll_to_date(self, date: datetime) -> None:
self._account, self._jid, date)
if meta is None:
return
- entitykey, timestamp = meta
- control.scroll_to_message(entitykey, timestamp)
+
+ control.scroll_to_message(*meta)
@staticmethod
def _on_row_activated(_listbox: SearchView, row: ResultRow) -> None:
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/d24d87d4f8a48effd399ccec7524aa100028e16e
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/d24d87d4f8a48effd399ccec7524aa100028e16e
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]