From 9fbd3f4bb6c87cafaac26cc6962c7734bc998825 Mon Sep 17 00:00:00 2001 From: terrtia Date: Thu, 16 Nov 2023 14:50:03 +0100 Subject: [PATCH] chg: [chats] add message and blur blocks --- bin/importer/feeders/abstract_chats_feeder.py | 2 +- bin/lib/chats_viewer.py | 2 +- .../templates/chats_explorer/ChatMessage.html | 48 ++-------- .../chats_explorer/SubChannelMessages.html | 50 ++--------- .../chats_explorer/block_message.html | 74 +++++++++++++++ .../chats_explorer/chat_instance.html | 2 +- .../templates/chats_explorer/chat_viewer.html | 89 ++----------------- .../chats_explorer/chats_instance.html | 2 +- .../chats_explorer/chats_protocols.html | 2 +- .../objects/image/block_blur_img_slider.html | 34 +++++++ 10 files changed, 134 insertions(+), 171 deletions(-) create mode 100644 var/www/templates/chats_explorer/block_message.html create mode 100644 var/www/templates/objects/image/block_blur_img_slider.html diff --git a/bin/importer/feeders/abstract_chats_feeder.py b/bin/importer/feeders/abstract_chats_feeder.py index f62500c7..c075a312 100755 --- a/bin/importer/feeders/abstract_chats_feeder.py +++ b/bin/importer/feeders/abstract_chats_feeder.py @@ -258,7 +258,7 @@ class AbstractChatFeeder(DefaultFeeder, ABC): obj.add(date, message) obj.set_parent(obj_global_id=message.get_global_id()) - for obj in objs: # TODO PERF avoid parsing metas multpile times + for obj in objs: # TODO PERF avoid parsing metas multiple times # CHAT chat = self.process_chat(obj, date, timestamp, reply_id=reply_id) diff --git a/bin/lib/chats_viewer.py b/bin/lib/chats_viewer.py index bae98988..8c201c4b 100755 --- a/bin/lib/chats_viewer.py +++ b/bin/lib/chats_viewer.py @@ -337,7 +337,7 @@ def api_get_message(message_id): message = Messages.Message(message_id) if not message.exists(): return {"status": "error", "reason": "Unknown uuid"}, 404 - meta = message.get_meta({'chat', 'content', 'icon', 'link', 'parent', 'parent_meta', 'user-account'}) + meta = message.get_meta({'chat', 'content', 'icon', 'images', 'link', 'parent', 'parent_meta', 'user-account'}) # if meta['chat']: # print(meta['chat']) # # meta['chat'] = diff --git a/var/www/templates/chats_explorer/ChatMessage.html b/var/www/templates/chats_explorer/ChatMessage.html index 0e96015c..5a129e66 100644 --- a/var/www/templates/chats_explorer/ChatMessage.html +++ b/var/www/templates/chats_explorer/ChatMessage.html @@ -134,6 +134,9 @@ + {% include 'objects/image/block_blur_img_slider.html' %} + +
@@ -143,48 +146,9 @@

-
-
- {{ meta['user-account']['id'] }} -
{{ meta['hour'] }}
-
-
-
- {% if meta['user-account']['username'] %} - {{ meta['user-account']['username']['id'] }} - {% else %} - {{ meta['user-account']['id'] }} - {% endif %} -
- {% if meta['reply_to'] %} -
-
- {% if meta['reply_to']['user-account']['username'] %} - {{ meta['reply_to']['user-account']['username']['id'] }} - {% else %} - {{ meta['reply_to']['user-account']['id'] }} - {% endif %} -
-
{{ meta['reply_to']['content'] }}
- {% for tag in meta['reply_to']['tags'] %} - {{ tag }} - {% endfor %} -
{{ meta['reply_to']['full_date'] }}
-{#
#} -{# #} -{# #} -{#
#} -
- {% endif %} -
{{ meta['content'] }}
- {% for tag in meta['tags'] %} - {{ tag }} - {% endfor %} -
- -
-
-
+ {% with message=meta %} + {% include 'chats_explorer/block_message.html' %} + {% endwith %}
diff --git a/var/www/templates/chats_explorer/SubChannelMessages.html b/var/www/templates/chats_explorer/SubChannelMessages.html index 198ad504..922b52da 100644 --- a/var/www/templates/chats_explorer/SubChannelMessages.html +++ b/var/www/templates/chats_explorer/SubChannelMessages.html @@ -144,6 +144,10 @@ + + {% include 'objects/image/block_blur_img_slider.html' %} + +
@@ -157,49 +161,9 @@ {% for mess in subchannel['messages'][date] %} -
-
- {{ mess['user-account']['id'] }} -
{{ mess['hour'] }}
-
-
-
- {% if mess['user-account']['username'] %} - {{ mess['user-account']['username']['id'] }} - {% else %} - {{ mess['user-account']['id'] }} - {% endif %} -
- {% if mess['reply_to'] %} -
-
- {% if mess['reply_to']['user-account']['username'] %} - {{ mess['reply_to']['user-account']['username']['id'] }} - {% else %} - {{ mess['reply_to']['user-account']['id'] }} - {% endif %} -
-
{{ mess['reply_to']['content'] }}
- {% for tag in mess['reply_to']['tags'] %} - {{ tag }} - {% endfor %} -
{{ mess['reply_to']['full_date'] }}
-{#
#} -{# #} -{# #} -{#
#} -
- {% endif %} -
{{ mess['content'] }}
- {% for tag in mess['tags'] %} - {{ tag }} - {% endfor %} -
- - -
-
-
+ {% with message=mess %} + {% include 'chats_explorer/block_message.html' %} + {% endwith %} {% endfor %}
diff --git a/var/www/templates/chats_explorer/block_message.html b/var/www/templates/chats_explorer/block_message.html new file mode 100644 index 00000000..df2c4d30 --- /dev/null +++ b/var/www/templates/chats_explorer/block_message.html @@ -0,0 +1,74 @@ + + + + + +
+
+ {{ message['user-account']['id'] }} +
{{ message['hour'] }}
+
+
+
+ {% if message['user-account']['username'] %} + {{ message['user-account']['username']['id'] }} + {% else %} + {{ message['user-account']['id'] }} + {% endif %} +
+ {% if message['reply_to'] %} +
+
+ {% if message['reply_to']['user-account']['username'] %} + {{ message['reply_to']['user-account']['username']['id'] }} + {% else %} + {{ message['reply_to']['user-account']['id'] }} + {% endif %} +
+
{{ message['reply_to']['content'] }}
+ {% for tag in message['reply_to']['tags'] %} + {{ tag }} + {% endfor %} +
{{ message['reply_to']['full_date'] }}
+ {#
#} + {# #} + {# #} + {#
#} +
+ {% endif %} + {% if message['images'] %} + + {% endif %} +
{{ message['content'] }}
+ {% for tag in message['tags'] %} + {{ tag }} + {% endfor %} +
+ + +
+
+
+ + diff --git a/var/www/templates/chats_explorer/chat_instance.html b/var/www/templates/chats_explorer/chat_instance.html index 419b8116..d70df757 100644 --- a/var/www/templates/chats_explorer/chat_instance.html +++ b/var/www/templates/chats_explorer/chat_instance.html @@ -106,7 +106,7 @@ @@ -442,15 +369,15 @@ d3.json("{{ url_for('chats_explorer.chats_explorer_messages_stats_week') }}?uuid tooltip.style("opacity", 1) d3.select(this) .style("stroke", "black") - .style("opacity", 1) + //.style("stroke-opacity", 1) tooltip.html(d.date + " " + d.hour + "-" + (d.hour + 1) + "h: " + d.count + " messages") } const mouseleave = function(d) { tooltip.style("opacity", 0) d3.select(this) - .style("stroke", "none") - .style("opacity", 0.8) + .style("stroke", "white") + //.style("stroke-opacity", 0.8) } /////////////////////////////////////////////////////////////////////////// diff --git a/var/www/templates/chats_explorer/chats_instance.html b/var/www/templates/chats_explorer/chats_instance.html index f7b56e39..a68fab7b 100644 --- a/var/www/templates/chats_explorer/chats_instance.html +++ b/var/www/templates/chats_explorer/chats_instance.html @@ -57,7 +57,7 @@ \ No newline at end of file