Browse Source

#477: e-mail notification about being added to private thread

Rafał Pitoń 10 years ago
parent
commit
37a1e069b8

+ 21 - 0
misago/templates/misago/emails/privatethread/added.html

@@ -0,0 +1,21 @@
+{% extends "misago/emails/base.html" %}
+{% load i18n misago_capture %}
+
+
+{% block content %}
+{% capture trimmed as thread_title %}
+<strong>{{ thread.title }}</strong>
+{% endcapture %}
+{% blocktrans trimmed with user=recipient.username sender=sender.username thread=thread_title %}
+{{ user }}, you are receiving this message because {{ sender }} has invited you to participate in private thread {{ thread }}.
+{% endblocktrans %}
+<br>
+<br>
+{% blocktrans trimmed %}
+To go to this thread click the link below:
+{% endblocktrans %}
+<br>
+<br>
+<a href="{{ SITE_ADDRESS }}{{ thread.get_absolute_url }}">{{ thread.title }}</a>
+<br>
+{% endblock content %}

+ 14 - 0
misago/templates/misago/emails/privatethread/added.txt

@@ -0,0 +1,14 @@
+{% extends "misago/emails/base.txt" %}
+{% load i18n %}
+
+
+{% block content %}
+{% blocktrans trimmed with user=recipient.username sender=sender.username thread=thread.title %}
+{{ user }}, you are receiving this message because {{ sender }} has invited you to participate in private thread "{{ thread }}".
+{% endblocktrans %}
+
+{% blocktrans trimmed %}
+To go to this thread click the link below:
+{% endblocktrans %}
+{{ SITE_ADDRESS }}{{ thread.get_absolute_url }}
+{% endblock content %}

+ 10 - 0
misago/threads/participants.py

@@ -1,4 +1,6 @@
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
+
+from misago.core.mail import mail_user
 from misago.notifications import notify_user
 from misago.notifications import notify_user
 
 
 from misago.threads.models import ThreadParticipant
 from misago.threads.models import ThreadParticipant
@@ -49,6 +51,14 @@ def add_participant(request, thread, user):
 
 
     set_user_unread_private_threads_sync(user)
     set_user_unread_private_threads_sync(user)
 
 
+    mail_subject = _("%(thread)s - %(user)s added you to private thread")
+    subject_formats = {'thread': thread.title, 'user': request.user.username}
+
+    mail_user(request, user, mail_subject % subject_formats,
+              'misago/emails/privatethread/added',
+              {'thread': thread})
+
+
 def add_owner(thread, user):
 def add_owner(thread, user):
     """
     """
     Add owner to thread, set "recound private threads" flag on user,
     Add owner to thread, set "recound private threads" flag on user,