From fb9e360679c581d853dc92d5c4d71e02fd2e3241 Mon Sep 17 00:00:00 2001 From: Horilla Date: Thu, 1 Feb 2024 13:03:44 +0530 Subject: [PATCH] [ADD] BASE: Employee notifications and announcement design change for mentions --- base/announcement.py | 17 ++++++ .../announcement/announcement_one.html | 59 +++++++++++-------- templates/announcement_single_view.html | 13 ++++ 3 files changed, 65 insertions(+), 24 deletions(-) diff --git a/base/announcement.py b/base/announcement.py index c2ecc1052..1d0cca361 100644 --- a/base/announcement.py +++ b/base/announcement.py @@ -212,6 +212,12 @@ def create_announcement_comment(request, anoun_id): form = AnnouncementcommentForm( initial={"employee_id": emp.id, "request_id": anoun_id} ) + comments = AnnouncementComment.objects.filter(announcement_id = anoun_id) + commentators = [] + if comments: + for i in comments: + commentators.append(i.employee_id.employee_user_id) + unique_users = list(set(commentators)) if request.method == "POST": form = AnnouncementcommentForm(request.POST) @@ -223,6 +229,17 @@ def create_announcement_comment(request, anoun_id): initial={"employee_id": emp.id, "request_id": anoun_id} ) messages.success(request, _("You commented a post.")) + notify.send( + request.user.employee_get, + recipient=unique_users, + verb=f"Comment under the announcement {anoun.title}.", + verb_ar=f"تعليق تحت الإعلان {anoun.title}.", + verb_de=f"Kommentar unter der Ankündigung {anoun.title}.", + verb_es=f"Comentario bajo el anuncio {anoun.title}.", + verb_fr=f"Commentaire sous l'annonce {anoun.title}.", + redirect="/", + icon="chatbox-ellipses", + ) return HttpResponse("") return render( request, diff --git a/base/templates/announcement/announcement_one.html b/base/templates/announcement/announcement_one.html index 6dd40114d..348a4be01 100644 --- a/base/templates/announcement/announcement_one.html +++ b/base/templates/announcement/announcement_one.html @@ -73,28 +73,6 @@

{{ anoun.description|safe }}

- {% if anoun.department.all %} - - {% endif %} - - {% if anoun.job_position.all %} - - {% endif %} - - {% endfor %} \ No newline at end of file + {% endfor %} diff --git a/templates/announcement_single_view.html b/templates/announcement_single_view.html index 1487e0135..f7884783f 100644 --- a/templates/announcement_single_view.html +++ b/templates/announcement_single_view.html @@ -168,3 +168,16 @@ aria-hidden="true" + + + \ No newline at end of file