From ce989adbd356cb830b06845a03f891d1d5122c3c Mon Sep 17 00:00:00 2001 From: terrtia Date: Wed, 8 Nov 2023 13:07:00 +0100 Subject: [PATCH] fix: [chats] fix username meta --- bin/lib/chats_viewer.py | 5 ++--- var/www/templates/chats_explorer/SubChannelMessages.html | 6 ++++-- var/www/templates/chats_explorer/chat_viewer.html | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bin/lib/chats_viewer.py b/bin/lib/chats_viewer.py index 3845a493..4e91f47c 100755 --- a/bin/lib/chats_viewer.py +++ b/bin/lib/chats_viewer.py @@ -307,7 +307,6 @@ def api_get_chat(chat_id, chat_instance_uuid): meta = chat.get_meta({'created_at', 'img', 'info', 'subchannels', 'username'}) if meta['username']: meta['username'] = get_username_meta_from_global_id(meta['username']) - print() if meta['subchannels']: meta['subchannels'] = get_subchannels_meta_from_global_id(meta['subchannels']) else: @@ -321,8 +320,8 @@ def api_get_subchannel(chat_id, chat_instance_uuid): meta = subchannel.get_meta({'chat', 'created_at', 'img', 'nb_messages'}) if meta['chat']: meta['chat'] = get_chat_meta_from_global_id(meta['chat']) - if meta['username']: - meta['username']: + if meta.get('username'): + meta['username'] = get_username_meta_from_global_id(meta['username']) meta['messages'], meta['tags_messages'] = subchannel.get_messages() return meta, 200 diff --git a/var/www/templates/chats_explorer/SubChannelMessages.html b/var/www/templates/chats_explorer/SubChannelMessages.html index 53a3deef..198ad504 100644 --- a/var/www/templates/chats_explorer/SubChannelMessages.html +++ b/var/www/templates/chats_explorer/SubChannelMessages.html @@ -54,7 +54,7 @@
-

{% if subchannel['chat']['name'] %}{{ subchannel['chat']['name'] }} {% else %} {{ subchannel['chat']['id'] }}{% endif %} - {% if subchannel['username'] %}{{ subchannel["username"] }} {% else %} {{ subchannel['name'] }}{% endif %} :

{{ subchannel["id"] }} +

{% if subchannel['chat']['name'] %}{{ subchannel['chat']['name'] }} {% else %} {{ subchannel['chat']['id'] }}{% endif %} - {% if subchannel['username'] %}{{ subchannel["username"]["id"] }} {% else %} {{ subchannel['name'] }}{% endif %} :

{{ subchannel["id"] }}
  • @@ -88,7 +88,9 @@ {% if 'username' in subchannel %} - {{ subchannel['username'] }} + {% if subchannel['username'] %} + {{ subchannel['username']['id'] }} + {% endif %} {% endif %} {{ subchannel['nb_messages'] }} diff --git a/var/www/templates/chats_explorer/chat_viewer.html b/var/www/templates/chats_explorer/chat_viewer.html index 62828b48..8010b508 100644 --- a/var/www/templates/chats_explorer/chat_viewer.html +++ b/var/www/templates/chats_explorer/chat_viewer.html @@ -51,7 +51,7 @@
    -

    {% if chat['username'] %}{{ chat["username"] }} {% else %} {{ chat['name'] }}{% endif %} :

    {{ chat["id"] }} +

    {% if chat['username'] %}{{ chat["username"]["id"] }} {% else %} {{ chat['name'] }}{% endif %} :

    {{ chat["id"] }}