Enhance user sorting and email resend functionality in CID group view: add sorting options for user list and improve email resend handling in candidate details view

This commit is contained in:
Ross
2025-12-15 12:15:42 +00:00
parent 77edc17732
commit 885ab1aad4
2 changed files with 106 additions and 23 deletions
+13 -3
View File
@@ -4959,11 +4959,21 @@ def group_email_results(request, pk, resend=False):
@user_is_cid_user_manager
def candidate_email_details(request, cid, resend=False):
user = CidUser.objects.get(cid=cid)
user = get_object_or_404(CidUser, cid=cid)
email_sent, comment = user.email_details(resend=False)
# Allow caller to request a resend via querystring or POST param
resend_flag = False
try:
if request.method == 'POST':
resend_flag = str(request.POST.get('resend', '')).lower() in ('1', 'true', 'yes')
else:
resend_flag = str(request.GET.get('resend', '')).lower() in ('1', 'true', 'yes')
except Exception:
resend_flag = False
return JsonResponse({"sent": email_sent, "comment": comment})
email_sent, comment = user.email_details(resend=resend_flag)
return JsonResponse({"sent": email_sent, "comment": str(comment)})
@user_is_cid_user_manager