changeset 1627:61449c5ddd70

browser (chat): Show all one2one message when profile own JID is used: When profile own JID is used, we want to show all one2one message, and not only message from the user themselve. This behaviour can be seen as an "inbox" of the user. rel 459
author Goffi <goffi@goffi.org>
date Sun, 08 Jun 2025 17:27:44 +0200
parents 00abe08875f5
children 84e287565fab
files libervia/web/pages/chat/page_meta.py
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/web/pages/chat/page_meta.py	Fri Jun 06 11:54:29 2025 +0200
+++ b/libervia/web/pages/chat/page_meta.py	Sun Jun 08 17:27:44 2025 +0200
@@ -80,14 +80,21 @@
         own_local_jid = profile_jid
     rdata["chat_type"] = chat_type
     template_data["own_local_jid"] = own_local_jid
+    filters = {}
+    from_jid_s = profile_jid.userhost()
+    to_jid_s = target_jid.bare
+    if from_jid_s == to_jid_s:
+        # If we are checking messages from user's profile, we show all one2one messages.
+        to_jid_s = ""
+        filters = {"not_types": C.CHAT_GROUP}
 
     history = await self.host.bridge_call(
         "history_get",
-        profile_jid.userhost(),
-        target_jid.bare,
+        from_jid_s,
+        to_jid_s,
         20,
         True,
-        {},
+        filters,
         profile,
     )