Skip to content

Commit

Permalink
Merge pull request #44 from Clubs-Council-IIITH/changein_delete_mail
Browse files Browse the repository at this point in the history
correct clubname and subject in delete event mail
  • Loading branch information
bhavberi authored Aug 24, 2024
2 parents 9fcd12b + 8fbc73a commit 68b693b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
6 changes: 6 additions & 0 deletions mailing_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@
""" # noqa: E501
)

DELETE_EVENT_SUBJECT = Template(
"""
[Events] $event_id: Deletion of $event
"""
)

DELETE_EVENT_BODY_FOR_CC = Template(
"""
Dear Clubs Council,
Expand Down
32 changes: 19 additions & 13 deletions mutations/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from mailing_templates import (
APPROVED_EVENT_BODY_FOR_CLUB,
CLUB_EVENT_SUBJECT,
DELETE_EVENT_SUBJECT,
DELETE_EVENT_BODY_FOR_CC,
DELETE_EVENT_BODY_FOR_CLUB,
PROGRESS_EVENT_BODY,
Expand Down Expand Up @@ -676,42 +677,46 @@ def deleteEvent(eventid: str, info: Info) -> EventType:
Event_State_Status.deleted,
Event_State_Status.incomplete,
]:
mail_club = getClubNameEmail(
event_instance.clubid, email=True, name=True
)
if mail_club is None:
raise Exception("Club does not exist.")
else:
clubname, mail_club = mail_club
if user["role"] == "cc":
mail_to = [
getClubNameEmail(
event_instance.clubid, email=True, name=False
),
mail_club,
]
mail_subject = CLUB_EVENT_SUBJECT.safe_substitute(
mail_subject = DELETE_EVENT_SUBJECT.safe_substitute(
event_id=event_instance.code,
event=event_instance.name,
)
mail_body = DELETE_EVENT_BODY_FOR_CLUB.safe_substitute(
club=event_instance.clubid,
club=clubname,
event=event_instance.name,
eventlink=getEventLink(event_instance.code),
deleted_by="Clubs Council",
)
if user["role"] == "slo":
mail_to = [
getClubNameEmail(
event_instance.clubid, email=True, name=False
),
mail_club,
]
mail_subject = CLUB_EVENT_SUBJECT.safe_substitute(
mail_subject = DELETE_EVENT_SUBJECT.safe_substitute(
event_id=event_instance.code,
event=event_instance.name,
)
mail_body = DELETE_EVENT_BODY_FOR_CLUB.safe_substitute(
club=event_instance.clubid,
club=clubname,
event=event_instance.name,
eventlink=getEventLink(event_instance.code),
deleted_by="Student Life Office",
)

# Mail to CC for the deleted event
mail_to_cc = getRoleEmails("cc")
mail_subject_cc = PROGRESS_EVENT_SUBJECT.safe_substitute(
mail_subject_cc = DELETE_EVENT_SUBJECT.safe_substitute(
event_id=event_instance.code,
event=event_instance.name,
)
mail_body_cc = DELETE_EVENT_BODY_FOR_CC.safe_substitute(
Expand All @@ -730,11 +735,12 @@ def deleteEvent(eventid: str, info: Info) -> EventType:

elif user["role"] == "club":
mail_to = getRoleEmails("cc")
mail_subject = PROGRESS_EVENT_SUBJECT.safe_substitute(
mail_subject = DELETE_EVENT_SUBJECT.safe_substitute(
event_id=event_instance.code,
event=event_instance.name,
)
mail_body = DELETE_EVENT_BODY_FOR_CC.safe_substitute(
club=event_instance.clubid,
club=clubname,
event=event_instance.name,
eventlink=getEventLink(event_instance.code),
)
Expand Down

0 comments on commit 68b693b

Please sign in to comment.