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

@@ -47,11 +47,13 @@ def mailing_subscribe_ajax(request):
user.user_profile.mailing_on = True
user.user_profile.save(update_fields=['mailing_on'])
return JsonResponse({
from GeneralApp.funcs import get_add_to_ajax_response_Dict
res_Dict = {
'status': 'sended',
'del_form': True,
'html': _('Подписка на рассылку для адреса ') + user.email + _(' одобрена')
})
}
res_Dict.update(get_add_to_ajax_response_Dict(request.user))
if not user:
try:
@@ -64,11 +66,14 @@ def mailing_subscribe_ajax(request):
else:
redirect_url = f"{reverse('registration_page')}?mailingSubscribeRequired=true"
return JsonResponse({
from GeneralApp.funcs import get_add_to_ajax_response_Dict
res_Dict = {
'status': 'sended',
'redirect_url': redirect_url,
'email': email
})
}
res_Dict.update(get_add_to_ajax_response_Dict(request.user))
return JsonResponse(res_Dict)
except Exception as e:
@@ -200,10 +205,15 @@ def send_message_ajax(request):
html = render_to_string('widgets/w_msg_send_success.html', Dict, request)
return JsonResponse({
from GeneralApp.funcs import get_add_to_ajax_response_Dict
res_Dict = {
'status': 'sended',
'html': html
})
}
res_Dict.update(get_add_to_ajax_response_Dict(request.user))
return JsonResponse(res_Dict)
except Exception as e:
return JsonResponse({
'status': 'error',
@@ -241,7 +251,11 @@ def chats_ajax(request):
Dict.update(get_user_timezone_Dict(request.user, request=request))
html = render_to_string('blocks/profile/b_chats.html', Dict, request=request)
return JsonResponse({'html': html}, status=200)
from GeneralApp.funcs import get_add_to_ajax_response_Dict
res_Dict = {'html': html}
res_Dict.update(get_add_to_ajax_response_Dict(request.user))
return JsonResponse(res_Dict)
@login_required()#login_url='/profile/login/')
def support_tickets_ajax(request):
@@ -252,7 +266,10 @@ def support_tickets_ajax(request):
html = get_profile_support_page_content_html(request)
return JsonResponse({'html': html}, status=200)
from GeneralApp.funcs import get_add_to_ajax_response_Dict
res_Dict = {'html': html}
res_Dict.update(get_add_to_ajax_response_Dict(request.user))
return JsonResponse(res_Dict)
@login_required()#login_url='/profile/login/')
@@ -283,7 +300,10 @@ def change_avatar_confirm_ajax(request):
print(msg)
return JsonResponse({'error': msg}, status=400)
return JsonResponse({'url': request.user.user_profile.avatar.url})
res_Dict = {'url': request.user.user_profile.avatar.url}
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/')
@@ -358,7 +378,10 @@ def change_profile_confirm_ajax(request):
user_profiles.update(**data_for_save)
html = get_profile_change_page_content_html(request)
return JsonResponse({'html': html}, status=200)
from GeneralApp.funcs import get_add_to_ajax_response_Dict
res_Dict = {'html': html}
res_Dict.update(get_add_to_ajax_response_Dict(request.user))
return JsonResponse(res_Dict)
@login_required()#login_url='/profile/login/')
@@ -403,7 +426,10 @@ def my_routes_ajax(request):
}
html = render_to_string('blocks/profile/b_my_routes.html', 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)
@@ -451,6 +477,8 @@ def login_ajax(request):
'redirect_url': redirect_url
}
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:
@@ -556,6 +584,8 @@ def registration_ajax(request):
# 'redirect_url': reverse('profile_page', args=['dashboard'])
}
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: