chg: [chats] show NB messages by chat

dev
terrtia 2024-01-26 16:06:42 +01:00
parent 74e41017a1
commit 61bccecdab
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
4 changed files with 7 additions and 3 deletions

View File

@ -178,7 +178,7 @@ class ChatServiceInstance:
if 'chats' in options:
meta['chats'] = []
for chat_id in self.get_chats():
meta['chats'].append(Chats.Chat(chat_id, self.uuid).get_meta({'created_at', 'icon', 'nb_subchannels'}))
meta['chats'].append(Chats.Chat(chat_id, self.uuid).get_meta({'created_at', 'icon', 'nb_subchannels', 'nb_messages'}))
return meta
def get_nb_chats(self):

View File

@ -83,6 +83,8 @@ class Chat(AbstractChatObject):
meta['participants'] = self.get_participants()
if 'nb_participants' in options:
meta['nb_participants'] = self.get_nb_participants()
if 'nb_messages' in options:
meta['nb_messages'] = self.get_nb_messages()
if 'username' in options:
meta['username'] = self.get_username()
if 'subchannels' in options:

View File

@ -63,7 +63,7 @@ def chats_explorer_networks():
return render_template('chats_networks.html', protocol=protocol, networks=networks)
@chats_explorer.route("chats/explorer/instance", methods=['GET'])
@chats_explorer.route("chats/explorer/instances", methods=['GET'])
@login_required
@login_read_only
def chats_explorer_instance():

View File

@ -70,7 +70,8 @@
<th>Created at</th>
<th>First Seen</th>
<th>Last Seen</th>
<th>NB SubChannels</th>
<th>SubChannels</th>
<th>Messages</th>
</tr>
</thead>
<tbody style="font-size: 15px;">
@ -94,6 +95,7 @@
{% endif %}
</td>
<td>{{ chat['nb_subchannels'] }}</td>
<td>{{ chat['nb_messages'] }}</td>
</tr>
{% endfor %}
</tbody>