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


Commits:
cd8d9b8e by wurstsalat at 2023-11-12T23:11:19+01:00
fix: SearchView: Fix displaying results for newly created group chats

Fixes #11681

- - - - -


2 changed files:

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


Changes:

=====================================
gajim/common/storage/archive.py
=====================================
@@ -126,6 +126,7 @@ class LastConversationRow(NamedTuple):
 class SearchLogRow(NamedTuple):
     account_id: int
     jid_id: int
+    jid: JID
     contact_name: str
     time: float
     kind: int
@@ -283,10 +284,6 @@ def _get_jid_ids_from_db(self) -> None:
             self._jid_ids[row.jid] = row
             self._jid_ids_reversed[row.jid_id] = row
 
-    def get_jid_from_id(self, jid_id: int) -> JidsTableRow | None:
-        # Use get as a fail-safe for cases where the JID ID table is incomplete
-        return self._jid_ids_reversed.get(jid_id)
-
     def get_jids_in_db(self) -> KeysView[JID]:
         return self._jid_ids.keys()
 
@@ -583,10 +580,6 @@ def search_log(self,
         '''
         Search the conversation log for messages containing the `query` string.
 
-        The search can either span the complete log for the given
-        `account` and `jid` or be restricted to a single day by
-        specifying `date`.
-
         :param account: The account
 
         :param jid: The jid for which we request the conversation
@@ -622,9 +615,20 @@ def search_log(self,
             users_query_string = 'AND UPPER(contact_name) IN (?)'
 
         sql = '''
-            SELECT account_id, jid_id, contact_name, time, kind, show, message,
-                   subject, additional_data, log_line_id
-            FROM logs NATURAL JOIN jids WHERE jid IN ({jids})
+            SELECT
+                account_id,
+                jid_id,
+                jid as "jid [jid]",
+                contact_name,
+                time,
+                kind,
+                show,
+                message,
+                subject,
+                additional_data,
+                log_line_id
+            FROM logs NATURAL JOIN jids
+            WHERE jid IN ({jids})
             AND account_id = {account_id}
             AND message LIKE like(?)
             AND kind NOT IN ({kinds})
@@ -699,9 +703,20 @@ def search_all_logs(self,
             users_query_string = 'AND UPPER(contact_name) IN (?)'
 
         sql = '''
-            SELECT account_id, jid_id, contact_name, time, kind, show, message,
-                   subject, additional_data, log_line_id
-            FROM logs WHERE message LIKE like(?)
+            SELECT
+                account_id,
+                jid_id,
+                jid as "jid [jid]",
+                contact_name,
+                time,
+                kind,
+                show,
+                message,
+                subject,
+                additional_data,
+                log_line_id
+            FROM logs NATURAL JOIN jids
+            WHERE message LIKE like(?)
             AND account_id IN ({account_ids})
             AND kind NOT IN ({kinds})
             {users_query}


=====================================
gajim/gtk/search_view.py
=====================================
@@ -196,13 +196,10 @@ def _add_results(self) -> None:
         accounts = self._get_accounts()
         assert self._results_iterator is not None
         for msg in itertools.islice(self._results_iterator, 25):
-            archive_jid = app.storage.archive.get_jid_from_id(msg.jid_id)
-            if archive_jid is None:
-                continue
             result_row = ResultRow(
                 msg,
                 accounts[msg.account_id],
-                JID.from_string(archive_jid.jid))
+                msg.jid)
 
             self._ui.results_listbox.add(result_row)
 



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

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