Skip to content

Commit

Permalink
Removed string based email triggers - now using boolean based on data…
Browse files Browse the repository at this point in the history
…base status
  • Loading branch information
Rutvikrj26 committed Nov 8, 2023
1 parent 879a047 commit a236062
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{% load i18n %}{% autoescape off %}{% filter wordwrap:70 %}
Dear {{ name }},
{% if status == 'Make cohost' %}
{% if status == True %}
You have been added as Cohost to the Event : {{ event_title }}.

You can now manage the event participants from your events dashboard.
{% elif status == 'Remove cohost' %}
{% elif status == False %}
Your Cohost access has been removed from the Event : {{ event_title }}.
{% endif %}
You can view further information about the event using the following link:
{{ event_url }}

Regards
The {{ SITE_NAME }} Team
{% endfilter %}{% endautoescape %}
{% endfilter %}{% endautoescape %}
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{% load i18n %}{% autoescape off %}{% filter wordwrap:70 %}
Dear {{ host_name }},
{% if status == 'Make cohost' %}

{% if status == True %}
You have provided {{ cohost_name }} Cohost access to the Event : {{ event_title }}.
{% elif status == 'Remove cohost' %}
{% elif status == False %}
You have removed {{ cohost_name }}'s Cohost access from the Event : {{ event_title }}.
{% endif %}
If this was done by mistake, you can change the cohost status by visiting the events dashboard.
{{ event_url }}

Regards
The {{ SITE_NAME }} Team
{% endfilter %}{% endautoescape %}
{% endfilter %}{% endautoescape %}
10 changes: 5 additions & 5 deletions physionet-django/events/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def manage_co_hosts(request):
"""
user = request.user

if request.method == 'POST' and request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest':
if request.method == 'POST':
participant_id = request.POST.get('participant_id')

event_slug = request.POST.get('event_slug')
Expand All @@ -270,9 +270,9 @@ def manage_co_hosts(request):
participant.is_cohost = False
participant.save()
notification.notify_event_cohost_cohost_status_change(request=request, cohost=participant.user,
event=event, status='Remove cohost')
event=event, status=participant.is_cohost)
notification.notify_event_host_cohost_status_change(request=request, cohost=participant.user, event=event,
status='Remove cohost')
status=participant.is_cohost)

return JsonResponse({'success': 'Cohost removed successfully'})
elif 'Make cohost' in request.POST.get('submit'):
Expand All @@ -281,9 +281,9 @@ def manage_co_hosts(request):
participant.is_cohost = True
participant.save()
notification.notify_event_cohost_cohost_status_change(request=request, cohost=participant.user,
event=event, status='Make cohost')
event=event, status=participant.is_cohost)
notification.notify_event_host_cohost_status_change(request=request, cohost=participant.user, event=event,
status='Make cohost')
status=participant.is_cohost)

return JsonResponse({'success': 'Cohost added successfully'})

Expand Down

0 comments on commit a236062

Please sign in to comment.