Skip to content

Commit 60d9875

Browse files
committed
chg: [message] show chat network and address
1 parent 7180529 commit 60d9875

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

bin/lib/chats_viewer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ def api_get_message(message_id, translation_target=None):
11971197
message = Messages.Message(message_id)
11981198
if not message.exists():
11991199
return {"status": "error", "reason": "Unknown uuid"}, 404
1200-
meta = message.get_meta({'barcodes', 'chat', 'container', 'content', 'files', 'files-names', 'forwarded_from', 'icon', 'images', 'language', 'link', 'parent', 'parent_meta', 'protocol', 'qrcodes', 'reactions', 'thread', 'translation', 'user-account'}, translation_target=translation_target)
1200+
meta = message.get_meta({'address', 'barcodes', 'chat', 'container', 'content', 'files', 'files-names', 'forwarded_from', 'icon', 'images', 'language', 'link', 'network', 'parent', 'parent_meta', 'protocol', 'qrcodes', 'reactions', 'thread', 'translation', 'user-account'}, translation_target=translation_target)
12011201
if 'forwarded_from' in meta:
12021202
chat = get_obj_chat_from_global_id(meta['forwarded_from'])
12031203
meta['forwarded_from'] = chat.get_meta({'icon'})

bin/lib/objects/Messages.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ def get_protocol(self):
8080
chat_instance = self.get_chat_instance()
8181
return r_obj.hget(f'chatSerIns:{chat_instance}', 'protocol')
8282

83+
def get_network(self):
84+
chat_instance = self.get_chat_instance()
85+
return r_obj.hget(f'chatSerIns:{chat_instance}', 'network')
86+
87+
def get_address(self):
88+
chat_instance = self.get_chat_instance()
89+
return r_obj.hget(f'chatSerIns:{chat_instance}', 'address')
90+
8391
def get_content(self, r_type='str'): # TODO ADD cache # TODO Compress content ???????
8492
"""
8593
Returns content
@@ -344,6 +352,10 @@ def get_meta(self, options=set(), timestamp=None, translation_target='', flask_c
344352
meta['content'] = self.get_content()
345353
if 'protocol':
346354
meta['protocol'] = self.get_protocol()
355+
if 'network':
356+
meta['network'] = self.get_network()
357+
if 'address':
358+
meta['address'] = self.get_address()
347359
if 'parent' in options:
348360
meta['parent'] = self.get_parent()
349361
if meta['parent'] and 'parent_meta' in options:

var/www/templates/chats_explorer/ChatMessage.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ <h4 class="card-title">
213213
{% endif %}
214214
<b>{{ meta['protocol']['id'] }}</b>
215215
</h4>
216+
{% if meta['network'] or meta['address'] %}<h6 class="card-title">
217+
{% if meta['network'] %}{{ meta['network'] }} {% endif %}{% if meta['address'] %}{{ meta['address'] }} {% endif %}
218+
</h6>{% endif %}
216219
</div>
217220
</div>
218221

0 commit comments

Comments
 (0)