1.3.6 add unanswered_msgs_count to all responses

This commit is contained in:
SDE
2024-06-29 14:44:19 +03:00
parent 75258f1706
commit 0e184f0b87
12 changed files with 147 additions and 45 deletions

View File

@@ -17,6 +17,9 @@ from AuthApp.funcs import get_user_timezone_Dict
def get_unanswered_msgs_count_for_user(user):
if not user or not user.is_authenticated:
return 0
msgs = Message.objects.filter(receiver=user, status='sended', group=None)
return msgs.count()

View File

@@ -38,7 +38,9 @@ def get_file_from_msg_ajax(request):
res_Dict = file
break
return JsonResponse(res_Dict, status=200)
from GeneralApp.funcs import get_add_to_ajax_response_Dict
res_Dict.update(get_add_to_ajax_response_Dict(request.user))
return JsonResponse(res_Dict)
except Exception as e:
msg = f'get_file_from_msg_ajax Error = {str(e)}'
@@ -63,10 +65,12 @@ def show_chat_w_user_ajax(request):
tpl_name = 'blocks/profile/b_chats.html'
html = render_to_string(tpl_name, Dict, request=request)
return JsonResponse({'html': html}, status=200)
res_Dict = {'html': html}
from GeneralApp.funcs import get_add_to_ajax_response_Dict
res_Dict.update(get_add_to_ajax_response_Dict(request.user))
return JsonResponse(res_Dict)
except Exception as e:
msg = f'show_chat_w_user_ajax Error = {str(e)}'
@@ -157,7 +161,9 @@ def update_chat_ajax2(request):
res_Dict.update({
'required_beep': required_beep,
})
return JsonResponse(res_Dict, status=200)
from GeneralApp.funcs import get_add_to_ajax_response_Dict
res_Dict.update(get_add_to_ajax_response_Dict(request.user))
return JsonResponse(res_Dict)
except Exception as e:
msg = f'update_chat_ajax2 Error = {str(e)}'
@@ -268,7 +274,10 @@ def update_chat_ajax(request):
res_Dict.update({
'required_beep': required_beep,
})
return JsonResponse(res_Dict, status=200)
from GeneralApp.funcs import get_add_to_ajax_response_Dict
res_Dict.update(get_add_to_ajax_response_Dict(request.user))
return JsonResponse(res_Dict)
except Exception as e:
msg = f'update_chat_ajax Error = {str(e)}'
@@ -435,7 +444,11 @@ def support_show_chat_by_ticket_ajax(request):
tpl_name = 'blocks/profile/b_support_chat.html'
Dict.update(get_user_timezone_Dict(request.user, request=request))
html = render_to_string(tpl_name, Dict, request=request)
return JsonResponse({'html': html}, status=200)
res_Dict = {'html': html}
from GeneralApp.funcs import get_add_to_ajax_response_Dict
res_Dict.update(get_add_to_ajax_response_Dict(request.user))
return JsonResponse(res_Dict)
except Exception as e:
msg = f'support_show_chat_by_ticket_ajax Error = {str(e)}'
@@ -461,7 +474,11 @@ def support_create_ticket_form_ajax(request):
tpl_name = 'blocks/profile/b_create_ticket.html'
html = render_to_string(tpl_name, Dict, request=request)
return JsonResponse({'html': html}, status=200)
res_Dict = {'html': html}
from GeneralApp.funcs import get_add_to_ajax_response_Dict
res_Dict.update(get_add_to_ajax_response_Dict(request.user))
return JsonResponse(res_Dict)
@login_required()#login_url='/profile/login/')
@@ -532,6 +549,8 @@ def create_ticket_ajax(request):
'html': html
}
from GeneralApp.funcs import get_add_to_ajax_response_Dict
res_Dict.update(get_add_to_ajax_response_Dict(request.user))
return JsonResponse(res_Dict)
except Exception as e: