chg: [chats] show NB messages by chat

This commit is contained in:
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: if 'chats' in options:
meta['chats'] = [] meta['chats'] = []
for chat_id in self.get_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 return meta
def get_nb_chats(self): def get_nb_chats(self):

View file

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

View file

@ -63,7 +63,7 @@ def chats_explorer_networks():
return render_template('chats_networks.html', protocol=protocol, networks=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_required
@login_read_only @login_read_only
def chats_explorer_instance(): def chats_explorer_instance():

View file

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