diff --git a/contentcuration/contentcuration/templates/registration/channel_published_email.html b/contentcuration/contentcuration/templates/registration/channel_published_email.html new file mode 100644 index 0000000000..476abbc1bd --- /dev/null +++ b/contentcuration/contentcuration/templates/registration/channel_published_email.html @@ -0,0 +1,31 @@ + +{% load i18n %} + +
+ + + + + {% autoescape off %} +{% blocktrans with name=user.first_name %}Hello {{ name }},{% endblocktrans %}
+ +{% blocktrans with channel_name=channel.name %}{{ channel_name }}{% endblocktrans %} ({{ domain }}{% url 'channel' channel_id=channel.pk %}) {% translate "has finished publishing! Here is the channel token (for importing it into Kolibri):" %}
+ +
+ {% blocktrans with channel_token=token %}Token: {{ channel_token }}{% endblocktrans %}
+
+ {% blocktrans with channel_id=channel.pk %}ID (for Kolibri version 0.6.0 and below): {{ channel_id }}{% endblocktrans %}
+
{% blocktrans with notes=notes %}Version notes: {{ notes }}{% endblocktrans %}
+ +
+ {% translate "Thanks for using Kolibri Studio!" %}
+
+ {% translate "The Learning Equality Team" %}
+
{% translate "You are receiving this email because you are subscribed to this channel." %}
+ {% endautoescape %} + + diff --git a/contentcuration/contentcuration/templates/registration/channel_published_email.txt b/contentcuration/contentcuration/templates/registration/channel_published_email.txt deleted file mode 100644 index b86cea7d93..0000000000 --- a/contentcuration/contentcuration/templates/registration/channel_published_email.txt +++ /dev/null @@ -1,23 +0,0 @@ -{% load i18n %} - -{% autoescape off %} -{% blocktrans with name=user.first_name %}Hello {{ name }},{% endblocktrans %} - -{% blocktrans with channel_name=channel.name %}{{ channel_name }} has finished publishing! Here is the channel token (for importing it into Kolibri):{% endblocktrans %} - -{% blocktrans with channel_token=token %}Token: {{ channel_token }}{% endblocktrans %} - -{% blocktrans with channel_id=channel.pk %}ID (for Kolibri version 0.6.0 and below): {{ channel_id }}{% endblocktrans %} - -{% blocktrans with notes=notes %}Version notes: {{ notes }}{% endblocktrans %} - - -{% translate "Thanks for using Kolibri Studio!" %} - -{% translate "The Learning Equality Team" %} - - - -{% translate "You are receiving this email because you are subscribed to this channel." %} - -{% endautoescape %} diff --git a/contentcuration/contentcuration/utils/publish.py b/contentcuration/contentcuration/utils/publish.py index 6593c14bc8..b3bbad1f37 100644 --- a/contentcuration/contentcuration/utils/publish.py +++ b/contentcuration/contentcuration/utils/publish.py @@ -14,6 +14,7 @@ from itertools import chain from django.conf import settings +from django.contrib.sites.models import Site from django.core.files import File from django.core.files.storage import default_storage as storage from django.core.management import call_command @@ -94,16 +95,19 @@ def send_emails(channel, user_id, version_notes=''): subject = render_to_string('registration/custom_email_subject.txt', {'subject': _('Kolibri Studio Channel Published')}) token = channel.secret_tokens.filter(is_primary=True).first() token = '{}-{}'.format(token.token[:5], token.token[-5:]) + domain = "https://{}".format(Site.objects.get_current().domain) if user_id: user = ccmodels.User.objects.get(pk=user_id) - message = render_to_string('registration/channel_published_email.txt', {'channel': channel, 'user': user, 'token': token, 'notes': version_notes}) - user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL, ) + message = render_to_string('registration/channel_published_email.html', + {'channel': channel, 'user': user, 'token': token, 'notes': version_notes, 'domain': domain}) + user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL, html_message=message) else: # Email all users about updates to channel for user in itertools.chain(channel.editors.all(), channel.viewers.all()): - message = render_to_string('registration/channel_published_email.txt', {'channel': channel, 'user': user, 'token': token, 'notes': version_notes}) - user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL, ) + message = render_to_string('registration/channel_published_email.html', + {'channel': channel, 'user': user, 'token': token, 'notes': version_notes, 'domain': domain}) + user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL, html_message=message) def create_content_database(channel, force, user_id, force_exercises, progress_tracker=None):