diff --git a/bin/lib/objects/Messages.py b/bin/lib/objects/Messages.py index f9c9288c..abecd594 100755 --- a/bin/lib/objects/Messages.py +++ b/bin/lib/objects/Messages.py @@ -278,7 +278,7 @@ class Message(AbstractObject): if 'last_full_date' in options: meta['last_full_date'] = meta['full_date'] - meta['source'] = self.get_source() + # meta['source'] = self.get_source() # optional meta fields if 'content' in options: meta['content'] = self.get_content() @@ -401,6 +401,35 @@ def create(obj_id, content, translation=None, tags=[]): # TODO Encode translation +##################################### + +# class Messages: +# def __init__(self): +# super().__init__('message', Message) +# +# def get_name(self): +# return 'Messages' +# +# def get_icon(self): +# return {'fas': 'fas', 'icon': 'comment-dots'} +# +# def get_link(self, flask_context=False): +# # if flask_context: +# # url = url_for('chats_explorer.chats_explorer_protocols') +# # else: +# # url = f'{baseurl}/chats/explorer/protocols' +# return None +# +# # def get_by_date(self, date): +# # pass +# +# def get_nb_by_date(self, date): +# nb = 0 +# for subtype in self.get_subtypes(): +# nb += self.get_nb_by_date_subtype(subtype, date) +# return nb + + if __name__ == '__main__': r = 'test' print(r) diff --git a/var/www/blueprints/correlation.py b/var/www/blueprints/correlation.py index 278e2b6d..63ba78a3 100644 --- a/var/www/blueprints/correlation.py +++ b/var/www/blueprints/correlation.py @@ -162,10 +162,21 @@ def get_description(): options = {'icon', 'tags', 'tags_safe'} if obj_type == 'message': options.add('content') + options.add('chat') res = ail_objects.get_object_meta(obj_type, subtype, obj_id, options=options, flask_context=True) if 'tags' in res: res['tags'] = list(res['tags']) + + if obj_type == 'message': + chat_id = res['chat'] + subtype = object_id[9:].split('/', 1)[0] + meta_chats = ail_objects.get_object_meta('chat', subtype, chat_id, options={'username', 'str_username'}) + if meta_chats["username"]: + res['chat'] = f'{meta_chats["username"]} - {meta_chats["name"]}' + else: + res['chat'] = f'{meta_chats["name"]}' + return jsonify(res) @correlation.route('/correlation/graph_node_json')