fix: [chats] fix templates, chat subtype

lang
terrtia 2024-03-05 14:14:04 +01:00
parent 87dc619171
commit 38d71e97dd
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
8 changed files with 26 additions and 26 deletions

View File

@ -58,7 +58,7 @@ def chats_explorer_networks():
networks = chats_viewer.get_chat_service_instances_by_protocol(protocol)
if len(networks) == 1:
instance_uuid = list(networks.values())[0]
return redirect(url_for('chats_explorer.chats_explorer_instance', uuid=instance_uuid))
return redirect(url_for('chats_explorer.chats_explorer_instance', subtype=instance_uuid))
else:
return render_template('chats_networks.html', protocol=protocol, networks=networks)
@ -67,7 +67,7 @@ def chats_explorer_networks():
@login_required
@login_read_only
def chats_explorer_instance():
intance_uuid = request.args.get('uuid')
intance_uuid = request.args.get('subtype')
chat_instance = chats_viewer.api_get_chat_service_instance(intance_uuid)
if chat_instance[1] != 200:
return create_json_response(chat_instance[0], chat_instance[1])
@ -80,7 +80,7 @@ def chats_explorer_instance():
@login_read_only
def chats_explorer_chat():
chat_id = request.args.get('id')
instance_uuid = request.args.get('uuid')
instance_uuid = request.args.get('subtype')
target = request.args.get('target')
if target == "Don't Translate":
target = None
@ -125,7 +125,7 @@ def chats_explorer_messages_stats_week_all():
@login_read_only
def objects_subchannel_messages():
subchannel_id = request.args.get('id')
instance_uuid = request.args.get('uuid')
instance_uuid = request.args.get('subtype')
target = request.args.get('target')
if target == "Don't Translate":
target = None
@ -144,7 +144,7 @@ def objects_subchannel_messages():
@login_read_only
def objects_thread_messages():
thread_id = request.args.get('id')
instance_uuid = request.args.get('uuid')
instance_uuid = request.args.get('subtype')
target = request.args.get('target')
if target == "Don't Translate":
target = None
@ -178,7 +178,7 @@ def chats_explorer_chat_participants():
@login_read_only
def chats_explorer_chat_download():
chat_id = request.args.get('id')
chat_subtype = request.args.get('uuid')
chat_subtype = request.args.get('subtype')
chat = chats_viewer.api_chat_messages(chat_subtype, chat_id)
if chat[1] != 200:
if chat[1] == 404:
@ -193,7 +193,7 @@ def chats_explorer_chat_download():
@login_read_only
def objects_subchannel_messages_download():
subchannel_id = request.args.get('id')
instance_uuid = request.args.get('uuid')
instance_uuid = request.args.get('subtype')
subchannel = chats_viewer.api_subchannel_messages(instance_uuid, subchannel_id)
if subchannel[1] != 200:
return create_json_response(subchannel[0], subchannel[1])
@ -206,7 +206,7 @@ def objects_subchannel_messages_download():
@login_read_only
def objects_thread_messages_download():
thread_id = request.args.get('id')
instance_uuid = request.args.get('uuid')
instance_uuid = request.args.get('subtype')
thread = chats_viewer.api_thread_messages(instance_uuid, thread_id)
if thread[1] != 200:
return create_json_response(thread[0], thread[1])

View File

@ -157,7 +157,7 @@
{% for thread in subchannel['threads'] %}
<tr>
<td>
<a href="{{ url_for('chats_explorer.objects_thread_messages')}}?uuid={{ thread['subtype'] }}&id={{ thread['id'] }}">{{ thread['name'] }} <i class="far fa-comment"></i> {{ thread['nb_messages'] }} Messages</a>
<a href="{{ url_for('chats_explorer.objects_thread_messages')}}?subtype={{ thread['subtype'] }}&id={{ thread['id'] }}">{{ thread['name'] }} <i class="far fa-comment"></i> {{ thread['nb_messages'] }} Messages</a>
</td>
<td>{{ thread["created_at"] }}</td>
<td>
@ -198,7 +198,7 @@
<span class="mt-3">
{% include 'objects/image/block_blur_img_slider.html' %}
</span>
{% with translate_url=url_for('chats_explorer.objects_subchannel_messages', uuid=subchannel['subtype']), obj_id=subchannel['id'], pagination=subchannel['pagination'] %}
{% with translate_url=url_for('chats_explorer.objects_subchannel_messages', subtype=subchannel['subtype']), obj_id=subchannel['id'], pagination=subchannel['pagination'] %}
{% include 'chats_explorer/block_translation.html' %}
{% endwith %}
{% with obj_subtype=subchannel['subtype'], obj_id=subchannel['id'], url_endpoint=url_for("chats_explorer.objects_subchannel_messages"), nb=subchannel['pagination']['nb'] %}
@ -206,7 +206,7 @@
{% set date_to=subchannel['last_seen'] %}
{% include 'block_obj_time_search.html' %}
{% endwith %}
{% with endpoint_url=url_for('chats_explorer.objects_subchannel_messages', uuid=subchannel['subtype']), pagination=subchannel['pagination'] %}
{% with endpoint_url=url_for('chats_explorer.objects_subchannel_messages', subtype=subchannel['subtype']), pagination=subchannel['pagination'] %}
{% set endpoint_url = endpoint_url + "&id=" + subchannel['id'] + "&nb=" + subchannel['pagination']['nb'] | string %}
{% if translation_target %}
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}
@ -238,7 +238,7 @@
</div>
</div>
{% with endpoint_url=url_for('chats_explorer.objects_subchannel_messages', uuid=subchannel['subtype']), pagination=subchannel['pagination'] %}
{% with endpoint_url=url_for('chats_explorer.objects_subchannel_messages', subtype=subchannel['subtype']), pagination=subchannel['pagination'] %}
{% set endpoint_url = endpoint_url + "&id=" + subchannel['id'] + "&nb=" + subchannel['pagination']['nb'] | string %}
{% if translation_target %}
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}

View File

@ -138,7 +138,7 @@
<span class="mt-3">
{% include 'objects/image/block_blur_img_slider.html' %}
</span>
{% with translate_url=url_for('chats_explorer.objects_thread_messages', uuid=meta['subtype']), obj_id=meta['id'], pagination=meta['pagination'] %}
{% with translate_url=url_for('chats_explorer.objects_thread_messages', subtype=meta['subtype']), obj_id=meta['id'], pagination=meta['pagination'] %}
{% include 'chats_explorer/block_translation.html' %}
{% endwith %}
{% with obj_subtype=meta['subtype'], obj_id=meta['id'], url_endpoint=url_for("chats_explorer.objects_thread_messages"), nb=meta['pagination']['nb'] %}
@ -146,7 +146,7 @@
{% set date_to=meta['last_seen'] %}
{% include 'block_obj_time_search.html' %}
{% endwith %}
{% with endpoint_url=url_for('chats_explorer.objects_thread_messages', uuid=meta['subtype']), pagination=meta['pagination'] %}
{% with endpoint_url=url_for('chats_explorer.objects_thread_messages', subtype=meta['subtype']), pagination=meta['pagination'] %}
{% set endpoint_url = endpoint_url + "&id=" + meta['id'] + "&nb=" + meta['pagination']['nb'] | string %}
{% if translation_target %}
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}
@ -178,7 +178,7 @@
</div>
</div>
{% with endpoint_url=url_for('chats_explorer.objects_thread_messages', uuid=meta['subtype']), pagination=meta['pagination'] %}
{% with endpoint_url=url_for('chats_explorer.objects_thread_messages', subtype=meta['subtype']), pagination=meta['pagination'] %}
{% set endpoint_url = endpoint_url + "&id=" + meta['id'] + "&nb=" + meta['pagination']['nb'] | string %}
{% if translation_target %}
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}

View File

@ -106,7 +106,7 @@
{% if message['thread'] %}
<hr class="mb-1">
<div class="my-2 text-center">
<a href="{{ url_for('chats_explorer.objects_thread_messages')}}?uuid={{ message['thread']['subtype'] }}&id={{ message['thread']['id'] }}"><i class="far fa-comment"></i> {{ message['thread']['nb'] }} Messages</a>
<a href="{{ url_for('chats_explorer.objects_thread_messages')}}?subtype={{ message['thread']['subtype'] }}&id={{ message['thread']['id'] }}"><i class="far fa-comment"></i> {{ message['thread']['nb'] }} Messages</a>
</div>
{% endif %}
{% for tag in message['tags'] %}

View File

@ -45,7 +45,7 @@
<script>
function filter_by_time() {
let parameter = "?uuid={{ obj_subtype }}&id={{ obj_id }}";
let parameter = "?subtype={{ obj_subtype }}&id={{ obj_id }}";
//let date_from = $('#date-range-from-input').val();
//let date_to = $('#date-range-to-input').val();
let nb_messages = $('#nb_messages').val();

View File

@ -82,7 +82,7 @@
class="rounded-circle mr-1" alt="{{ chat['id'] }}" width="40" height="40">
</td>
<td><b>{{ chat['name'] }}</b></td>
<td><a href="{{ url_for('chats_explorer.chats_explorer_chat') }}?uuid={{ chat_instance['uuid'] }}&id={{ chat['id'] }}">{{ chat['id'] }}</a></td>
<td><a href="{{ url_for('chats_explorer.chats_explorer_chat') }}?subtype={{ chat_instance['uuid'] }}&id={{ chat['id'] }}">{{ chat['id'] }}</a></td>
<td>{{ chat['created_at'] }}</td>
<td>
{% if chat['first_seen'] %}

View File

@ -116,10 +116,6 @@
<span class="badge badge-{{ bootstrap_label[loop.index0 % 5] }}">{{ tag }} <span class="badge badge-light">{{ chat['tags_messages'][tag] }}</span></span>
{% endfor %}
{% with translate_url=url_for('chats_explorer.chats_explorer_chat', uuid=chat['subtype']), obj_id=chat['id'], pagination=chat['pagination'] %}
{% include 'chats_explorer/block_translation.html' %}
{% endwith %}
{% if chat['subchannels'] %}
<h4 class="mt-2">Sub-Channels:</h4>
<table id="tablesubchannels" class="table">
@ -146,7 +142,7 @@
<div class="text-secondary">{{ meta['translation_name'] }}</div>
{% endif %}
</td>
<td><a href="{{ url_for('chats_explorer.objects_subchannel_messages') }}?uuid={{ meta['subtype'] }}&id={{ meta['id'] }}">{{ meta['id'] }}</a></td>
<td><a href="{{ url_for('chats_explorer.objects_subchannel_messages') }}?subtype={{ meta['subtype'] }}&id={{ meta['id'] }}">{{ meta['id'] }}</a></td>
<td>{{ meta['created_at'] }}</td>
<td>
{% if meta['first_seen'] %}
@ -174,6 +170,10 @@
<div id="heatmapweekhour"></div>
{% endif %}
{% with translate_url=url_for('chats_explorer.chats_explorer_chat', subtype=chat['subtype']), obj_id=chat['id'], pagination=chat['pagination'] %}
{% include 'chats_explorer/block_translation.html' %}
{% endwith %}
{% if chat['messages'] %}
<span class="mt-3">
@ -185,7 +185,7 @@
{% set date_to=chat['last_seen'] %}
{% include 'block_obj_time_search.html' %}
{% endwith %}
{% with endpoint_url=url_for('chats_explorer.chats_explorer_chat', uuid=chat['subtype']), pagination=chat['pagination'] %}
{% with endpoint_url=url_for('chats_explorer.chats_explorer_chat', subtype=chat['subtype']), pagination=chat['pagination'] %}
{% set endpoint_url = endpoint_url + "&id=" + chat['id'] + "&nb=" + chat['pagination']['nb'] | string %}
{% if translation_target %}
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}
@ -217,7 +217,7 @@
</div>
</div>
{% with endpoint_url=url_for('chats_explorer.chats_explorer_chat', uuid=chat['subtype']), pagination=chat['pagination'] %}
{% with endpoint_url=url_for('chats_explorer.chats_explorer_chat', subtype=chat['subtype']), pagination=chat['pagination'] %}
{% set endpoint_url = endpoint_url + "&id=" + chat['id'] + "&nb=" + chat['pagination']['nb'] | string %}
{% if translation_target %}
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}

View File

@ -39,7 +39,7 @@
{% for instance_uuid in networks[network] %}
<li class="list-group-item">
<a class="nav-link" href="{{url_for('chats_explorer.chats_explorer_instance')}}?uuid={{ instance_uuid }}">
<a class="nav-link" href="{{url_for('chats_explorer.chats_explorer_instance')}}?subtype={{ instance_uuid }}">
<span>{{ instance_uuid }}</span>
</a>
</li>