Commit 819e8609 authored by Joost Rijneveld's avatar Joost Rijneveld
Browse files

Merge branch 'fix/event-queue-mail-url' into 'master'

Add base url to event queue mail

Closes #456

See merge request !527
parents 09a49de8 70326fab
{% load i18n baseurl %}{% blocktrans with event_title=event.title event_url=event.get_absolute_url registration_date=registration.date|date:"SHORT_DATETIME_FORMAT" cancel_deadline=event.cancel_deadline|date:"SHORT_DATETIME_FORMAT" name=member.user.first_name %}Hi {{ name }},
{% load i18n %}{% blocktrans with event_title=event.title baseurl=base_url event_url=event.get_absolute_url registration_date=registration.date|date:"SHORT_DATETIME_FORMAT" cancel_deadline=event.cancel_deadline|date:"SHORT_DATETIME_FORMAT" name=member.user.first_name %}Hi {{ name }},
You registered for the event '{{ event_title }}' on {{ registration_date }} and unfortunately you were placed on the waiting list.
However someone just unregistered and we would like to let you know that you'll be able to attend now!
You can find more information about the event on the website: {{ event_url }}
You can find more information about the event on the website: {{ baseurl }}{{ event_url }}
We're assuming that you'll be there, but you're still able to unregister until {{ cancel_deadline }}.
......
......@@ -15,6 +15,7 @@ from django.utils.translation import pgettext_lazy
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.http import require_http_methods
from thaliawebsite.templatetags import baseurl
from .forms import FieldsForm
from .models import Event, Registration, RegistrationInformationField
......@@ -200,7 +201,7 @@ def event(request, event_id):
return render(request, 'events/event.html', context)
def _send_queue_mail(event):
def _send_queue_mail(request, event):
if (event.max_participants is not None and
Registration.objects
.filter(event=event, date_cancelled=None)
......@@ -214,6 +215,8 @@ def _send_queue_mail(event):
text_template = get_template('events/email.txt')
base_url = baseurl.baseurl({'request': request})
with translation.override(first_waiting_member.language):
subject = _("[THALIA] Notification about your "
"registration for '{}'").format(
......@@ -221,6 +224,7 @@ def _send_queue_mail(event):
text_message = text_template.render({
'event': event,
'reg': first_waiting,
'base_url': base_url,
'member': first_waiting_member
})
......@@ -306,7 +310,7 @@ def _registration_cancel(request, event, reg):
messages.error(request, _("You are not registered for this event."))
else:
if reg.queue_position() == 0:
_send_queue_mail(event)
_send_queue_mail(request, event)
# Note that this doesn't remove the values for the
# information fields that the user entered upon registering.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment