From c1fd3f299432fd36e6250aafdb0823f7a3977f80 Mon Sep 17 00:00:00 2001 From: Vivek Agrawal Date: Mon, 31 Oct 2022 17:55:00 +0530 Subject: [PATCH] Wrap channel name in tag & hyperlink between brackets --- .../registration/channel_published_email.html | 31 +++++++++++++++++++ .../registration/channel_published_email.txt | 27 ---------------- .../contentcuration/utils/publish.py | 8 ++--- 3 files changed, 35 insertions(+), 31 deletions(-) create mode 100644 contentcuration/contentcuration/templates/registration/channel_published_email.html delete mode 100644 contentcuration/contentcuration/templates/registration/channel_published_email.txt 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 ddabab61b1..0000000000 --- a/contentcuration/contentcuration/templates/registration/channel_published_email.txt +++ /dev/null @@ -1,27 +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!{% endblocktrans %} - -{% translate "Link to the channel: " %}{{ domain }}{% url 'channel' channel_id=channel.pk %} - -{% translate "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/utils/publish.py b/contentcuration/contentcuration/utils/publish.py index 0455083597..b3bbad1f37 100644 --- a/contentcuration/contentcuration/utils/publish.py +++ b/contentcuration/contentcuration/utils/publish.py @@ -99,15 +99,15 @@ def send_emails(channel, user_id, version_notes=''): if user_id: user = ccmodels.User.objects.get(pk=user_id) - message = render_to_string('registration/channel_published_email.txt', + 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, ) + 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', + 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, ) + 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):