fix: [chats] fix username meta

This commit is contained in:
terrtia 2023-11-08 13:07:00 +01:00
parent 207a6524d7
commit ce989adbd3
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
3 changed files with 7 additions and 6 deletions

View file

@ -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

View file

@ -54,7 +54,7 @@
<div class="card my-3">
<div class="card-header" style="background-color:#d9edf7;font-size: 15px">
<h3 class="text-secondary">{% if subchannel['chat']['name'] %}{{ subchannel['chat']['name'] }} {% else %} {{ subchannel['chat']['id'] }}{% endif %} - {% if subchannel['username'] %}{{ subchannel["username"] }} {% else %} {{ subchannel['name'] }}{% endif %} :</h3> {{ subchannel["id"] }}
<h3 class="text-secondary">{% if subchannel['chat']['name'] %}{{ subchannel['chat']['name'] }} {% else %} {{ subchannel['chat']['id'] }}{% endif %} - {% if subchannel['username'] %}{{ subchannel["username"]["id"] }} {% else %} {{ subchannel['name'] }}{% endif %} :</h3> {{ subchannel["id"] }}
<ul class="list-group mb-2">
<li class="list-group-item py-0">
<div class="row">
@ -88,7 +88,9 @@
</td>
<td>
{% if 'username' in subchannel %}
{{ subchannel['username'] }}
{% if subchannel['username'] %}
{{ subchannel['username']['id'] }}
{% endif %}
{% endif %}
</td>
<td>{{ subchannel['nb_messages'] }}</td>

View file

@ -51,7 +51,7 @@
<div class="card my-3">
<div class="card-header" style="background-color:#d9edf7;font-size: 15px">
<h4 class="text-secondary">{% if chat['username'] %}{{ chat["username"] }} {% else %} {{ chat['name'] }}{% endif %} :</h4> {{ chat["id"] }}
<h4 class="text-secondary">{% if chat['username'] %}{{ chat["username"]["id"] }} {% else %} {{ chat['name'] }}{% endif %} :</h4> {{ chat["id"] }}
<ul class="list-group mb-2">
<li class="list-group-item py-0">
<table class="table">