Skip to content

Commit

Permalink
chg: [chats] show username
Browse files Browse the repository at this point in the history
  • Loading branch information
Terrtia committed Sep 16, 2024
1 parent 2168642 commit f4da8c5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/lib/chats_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def get_meta(self, options=set()):
meta['chats'] = []
for chat_id in self.get_chats_with_messages():
meta['chats'].append(
Chats.Chat(chat_id, self.uuid).get_meta({'created_at', 'icon', 'nb_subchannels', 'nb_messages'}))
Chats.Chat(chat_id, self.uuid).get_meta({'created_at', 'icon', 'nb_subchannels', 'nb_messages', 'username', 'str_username'}))
return meta

def get_nb_chats(self):
Expand Down
2 changes: 2 additions & 0 deletions bin/lib/objects/Chats.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def get_meta(self, options=set(), translation_target=None):
meta['nb_messages'] = self.get_nb_messages()
if 'username' in options:
meta['username'] = self.get_username()
if meta['username'] and 'str_username' in options:
meta['username'] = meta['username'].split(':', 2)[2]
if 'subchannels' in options:
meta['subchannels'] = self.get_subchannels()
if 'nb_subchannels':
Expand Down
12 changes: 9 additions & 3 deletions var/www/templates/chats_explorer/chat_instance.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ <h4 class="text-secondary">{{ chat_instance["protocol"] }} :</h4>
<thead class="bg-dark text-white">
<tr>
<th>Icon</th>
<th>Name</th>
<th>ID</th>
<th>Name</th>
<th>Username</th>
<th>Created at</th>
<th>First Seen</th>
<th>Last Seen</th>
Expand All @@ -81,8 +82,13 @@ <h4 class="text-secondary">{{ chat_instance["protocol"] }} :</h4>
<img src="{% if chat['icon'] %}{{ url_for('objects_image.image', filename=chat['icon'])}}{% else %}{{ url_for('static', filename='image/ail-icon.png') }}{% endif %}"
class="rounded-circle mr-1" alt="{{ chat['id'] }}" width="40" height="40">
</td>
<td><b>{{ chat['name'] }}</b></td>
<td><a href="{{ url_for('chats_explorer.chats_explorer_chat') }}?subtype={{ chat_instance['uuid'] }}&id={{ chat['id'] }}">{{ chat['id'] }}</a></td>
<td><b>{{ chat['name'] }}</b></td>
<td>
{% if chat['username'] %}
{{ chat['username'] }}
{% endif %}
</td>
<td>{{ chat['created_at'] }}</td>
<td>
{% if chat['first_seen'] %}
Expand Down Expand Up @@ -114,7 +120,7 @@ <h4 class="text-secondary">{{ chat_instance["protocol"] }} :</h4>
$('#tablechats').DataTable({
"aLengthMenu": [[5, 10, 15, -1], [5, 10, 15, "All"]],
"iDisplayLength": 10,
"order": [[ 5, "desc" ]]
"order": [[ 6, "desc" ]]
});
});

Expand Down

0 comments on commit f4da8c5

Please sign in to comment.