From 67316707e7e59da753babc18538b090a9dfd05c7 Mon Sep 17 00:00:00 2001 From: Zambom Date: Tue, 7 Nov 2017 17:06:13 -0300 Subject: [PATCH] Adjusting chat first message filter problem --- amadeus/static/js/chat.js | 4 ++++ chat/views.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/amadeus/static/js/chat.js b/amadeus/static/js/chat.js index a9cfa7c..2cc0618 100644 --- a/amadeus/static/js/chat.js +++ b/amadeus/static/js/chat.js @@ -287,6 +287,8 @@ function setChatFormSubmit() { var height = $(this)[0].scrollHeight; $(this).animate({scrollTop: height}, 0); + + $(this).attr('data-url', data.load_msg_url); }); if (typeof(new_msgs[data.talk_id]) == 'undefined') { @@ -345,6 +347,8 @@ function setShortChatFormSubmit() { var height = $(this)[0].scrollHeight; $(this).animate({scrollTop: height}, 0); + + $(this).attr('data-url', data.load_msg_url); }); if (typeof(new_msgs[data.talk_id]) == 'undefined') { diff --git a/chat/views.py b/chat/views.py index 83ded55..f5bca79 100644 --- a/chat/views.py +++ b/chat/views.py @@ -422,10 +422,11 @@ def render_message(request, talk_msg, talk_id, space, space_type, email): context['talk_msg'] = msg form_url = reverse_lazy('chat:create', args = (), kwargs = {'email': email, 'talk_id': talk_id, 'space': space, 'space_type': space_type}) + loading_msg = reverse_lazy('chat:load_messages', args = (msg.talk.id, )) html = render_to_string("chat/_message.html", context, request) - return JsonResponse({'view': html, 'new_id': msg.id, 'talk_id': msg.talk.id, 'new_form_url': form_url}) + return JsonResponse({'view': html, 'new_id': msg.id, 'talk_id': msg.talk.id, 'new_form_url': form_url, 'load_msg_url': loading_msg}) @login_required def favorite(request, message): -- libgit2 0.21.2