fix: [chat view] fix created_at + filter

dev
terrtia 2024-01-29 10:52:18 +01:00
parent 6a24c58c8b
commit 6363a4f1cf
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
4 changed files with 9 additions and 13 deletions

View File

@ -280,7 +280,6 @@ def create_chat_service_instance(protocol, network=None, address=None):
#######################################################################################
def get_obj_chat(chat_type, chat_subtype, chat_id):
print(chat_type, chat_subtype, chat_id)
if chat_type == 'chat':
return Chats.Chat(chat_id, chat_subtype)
elif chat_type == 'chat-subchannel':
@ -305,7 +304,7 @@ def get_subchannels_meta_from_global_id(subchannels):
for sub in subchannels:
_, instance_uuid, sub_id = sub.split(':', 2)
subchannel = ChatSubChannels.ChatSubChannel(sub_id, instance_uuid)
meta.append(subchannel.get_meta({'nb_messages'}))
meta.append(subchannel.get_meta({'nb_messages', 'created_at', 'icon'}))
return meta
def get_chat_meta_from_global_id(chat_global_id):
@ -399,9 +398,6 @@ def api_get_message(message_id, translation_target=None):
if not message.exists():
return {"status": "error", "reason": "Unknown uuid"}, 404
meta = message.get_meta({'chat', 'content', 'files-names', 'icon', 'images', 'link', 'parent', 'parent_meta', 'reactions', 'thread', 'translation', 'user-account'}, translation_target=translation_target)
# if meta['chat']:
# print(meta['chat'])
# # meta['chat'] =
return meta, 200
def api_get_user_account(user_id, instance_uuid):

View File

@ -82,8 +82,9 @@ class ChatSubChannel(AbstractChatObject):
meta['name'] = self.get_name()
if 'chat' in options:
meta['chat'] = self.get_chat()
if 'img' in options:
meta['img'] = self.get_img()
if 'icon' in options:
meta['icon'] = self.get_icon()
meta['img'] = meta['icon']
if 'nb_messages' in options:
meta['nb_messages'] = self.get_nb_messages()
if 'created_at' in options:

View File

@ -95,7 +95,6 @@ class Chat(AbstractChatObject):
meta['created_at'] = self.get_created_at(date=True)
if 'threads' in options:
meta['threads'] = self.get_threads()
print(meta['threads'])
if 'tags_safe' in options:
meta['tags_safe'] = self.is_tags_safe(meta['tags'])
return meta

View File

@ -39,9 +39,9 @@
</div>
</div>
<link href="{{ url_for('static', filename='css/daterangepicker.min.css') }}" rel="stylesheet">
<script src="{{ url_for('static', filename='js/moment.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/jquery.daterangepicker.min.js') }}"></script>
{#<link href="{{ url_for('static', filename='css/daterangepicker.min.css') }}" rel="stylesheet">#}
{#<script src="{{ url_for('static', filename='js/moment.min.js') }}"></script>#}
{#<script src="{{ url_for('static', filename='js/jquery.daterangepicker.min.js') }}"></script>#}
<script>
function filter_by_time() {
@ -55,7 +55,7 @@
}
$('#date-range-from').dateRangePicker({
/*$('#date-range-from').dateRangePicker({
separator : ' to ',
getValue: function(){
if ($('#date-range-from-input').val() && $('#date-range-to-input').val() )
@ -80,6 +80,6 @@
$('#date-range-from-input').val(s1);
$('#date-range-to-input').val(s2);
}
});
});*/
</script>