diff --git a/physionet-django/events/templates/events/email/event_cohost_cohost_status_change.html b/physionet-django/events/templates/events/email/event_cohost_cohost_status_change.html index fbc4a5be78..6e3a633534 100644 --- a/physionet-django/events/templates/events/email/event_cohost_cohost_status_change.html +++ b/physionet-django/events/templates/events/email/event_cohost_cohost_status_change.html @@ -1,10 +1,10 @@ {% 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: @@ -12,4 +12,4 @@ Regards The {{ SITE_NAME }} Team -{% endfilter %}{% endautoescape %} +{% endfilter %}{% endautoescape %} \ No newline at end of file diff --git a/physionet-django/events/templates/events/email/event_host_cohost_status_change.html b/physionet-django/events/templates/events/email/event_host_cohost_status_change.html index dcaa1e4a1f..fcecfef1e4 100644 --- a/physionet-django/events/templates/events/email/event_host_cohost_status_change.html +++ b/physionet-django/events/templates/events/email/event_host_cohost_status_change.html @@ -1,8 +1,9 @@ {% 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. @@ -10,4 +11,4 @@ Regards The {{ SITE_NAME }} Team -{% endfilter %}{% endautoescape %} +{% endfilter %}{% endautoescape %} \ No newline at end of file diff --git a/physionet-django/events/views.py b/physionet-django/events/views.py index d12584772d..3af4688bdb 100644 --- a/physionet-django/events/views.py +++ b/physionet-django/events/views.py @@ -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') @@ -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'): @@ -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'})