From 6363a4f1cfb18e036c1773c3bde4f8759aa194a9 Mon Sep 17 00:00:00 2001 From: terrtia Date: Mon, 29 Jan 2024 10:52:18 +0100 Subject: [PATCH] fix: [chat view] fix created_at + filter --- bin/lib/chats_viewer.py | 6 +----- bin/lib/objects/ChatSubChannels.py | 5 +++-- bin/lib/objects/Chats.py | 1 - .../chats_explorer/block_obj_time_search.html | 10 +++++----- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/bin/lib/chats_viewer.py b/bin/lib/chats_viewer.py index 69b913f4..a8346bac 100755 --- a/bin/lib/chats_viewer.py +++ b/bin/lib/chats_viewer.py @@ -280,7 +280,6 @@ def create_chat_service_instance(protocol, network=None, address=None): ####################################################################################### def get_obj_chat(chat_type, chat_subtype, chat_id): - print(chat_type, chat_subtype, chat_id) if chat_type == 'chat': return Chats.Chat(chat_id, chat_subtype) elif chat_type == 'chat-subchannel': @@ -305,7 +304,7 @@ def get_subchannels_meta_from_global_id(subchannels): for sub in subchannels: _, instance_uuid, sub_id = sub.split(':', 2) subchannel = ChatSubChannels.ChatSubChannel(sub_id, instance_uuid) - meta.append(subchannel.get_meta({'nb_messages'})) + meta.append(subchannel.get_meta({'nb_messages', 'created_at', 'icon'})) return meta def get_chat_meta_from_global_id(chat_global_id): @@ -399,9 +398,6 @@ def api_get_message(message_id, translation_target=None): if not message.exists(): return {"status": "error", "reason": "Unknown uuid"}, 404 meta = message.get_meta({'chat', 'content', 'files-names', 'icon', 'images', 'link', 'parent', 'parent_meta', 'reactions', 'thread', 'translation', 'user-account'}, translation_target=translation_target) - # if meta['chat']: - # print(meta['chat']) - # # meta['chat'] = return meta, 200 def api_get_user_account(user_id, instance_uuid): diff --git a/bin/lib/objects/ChatSubChannels.py b/bin/lib/objects/ChatSubChannels.py index 7a799240..ef343baa 100755 --- a/bin/lib/objects/ChatSubChannels.py +++ b/bin/lib/objects/ChatSubChannels.py @@ -82,8 +82,9 @@ class ChatSubChannel(AbstractChatObject): meta['name'] = self.get_name() if 'chat' in options: meta['chat'] = self.get_chat() - if 'img' in options: - meta['img'] = self.get_img() + if 'icon' in options: + meta['icon'] = self.get_icon() + meta['img'] = meta['icon'] if 'nb_messages' in options: meta['nb_messages'] = self.get_nb_messages() if 'created_at' in options: diff --git a/bin/lib/objects/Chats.py b/bin/lib/objects/Chats.py index 746f0dea..c894cc26 100755 --- a/bin/lib/objects/Chats.py +++ b/bin/lib/objects/Chats.py @@ -95,7 +95,6 @@ class Chat(AbstractChatObject): meta['created_at'] = self.get_created_at(date=True) if 'threads' in options: meta['threads'] = self.get_threads() - print(meta['threads']) if 'tags_safe' in options: meta['tags_safe'] = self.is_tags_safe(meta['tags']) return meta diff --git a/var/www/templates/chats_explorer/block_obj_time_search.html b/var/www/templates/chats_explorer/block_obj_time_search.html index 515a8ea7..60401d42 100644 --- a/var/www/templates/chats_explorer/block_obj_time_search.html +++ b/var/www/templates/chats_explorer/block_obj_time_search.html @@ -39,9 +39,9 @@ - - - +{##} +{##} +{##}