summaryrefslogtreecommitdiffstats
path: root/askbot
diff options
context:
space:
mode:
authorVasil Vangelovski <vvangelovski@gmail.com>2012-01-30 10:57:15 +0100
committerVasil Vangelovski <vvangelovski@gmail.com>2012-01-30 10:57:15 +0100
commite31c96c8bc4d4a521725e2d3fc66e5febc88c7a1 (patch)
treee12f2fa32d6591909a393b038975dce976f5121f /askbot
parentd23553c24c4a8f71d130ac5d5d78f335a49a2ccd (diff)
downloadaskbot-e31c96c8bc4d4a521725e2d3fc66e5febc88c7a1.tar.gz
askbot-e31c96c8bc4d4a521725e2d3fc66e5febc88c7a1.tar.bz2
askbot-e31c96c8bc4d4a521725e2d3fc66e5febc88c7a1.zip
Smarter message in instant notification when reply by email is enabled
Diffstat (limited to 'askbot')
-rw-r--r--askbot/models/__init__.py18
-rw-r--r--askbot/skins/default/templates/instant_notification_reply_by_email.html9
2 files changed, 20 insertions, 7 deletions
diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py
index 656fa6f3..d6f84a57 100644
--- a/askbot/models/__init__.py
+++ b/askbot/models/__init__.py
@@ -2280,6 +2280,7 @@ def format_instant_notification_email(
'receiving_user_name': to_user.username,
'receiving_user_karma': to_user.reputation,
'reply_by_email_karma_threshold': askbot_settings.MIN_REP_TO_POST_BY_EMAIL,
+ 'can_reply': to_user.reputation > askbot_settings.MIN_REP_TO_POST_BY_EMAIL,
'content_preview': content_preview,#post.get_snippet()
'update_type': update_type,
'post_url': site_url + post.get_absolute_url(),
@@ -2317,15 +2318,18 @@ def send_instant_notifications_about_activity_in_post(
origin_post = post.get_origin_post()
for user in recipients:
+
if askbot_settings.REPLY_BY_EMAIL:
template = get_template('instant_notification_reply_by_email.html')
+
subject_line, body_text = format_instant_notification_email(
- to_user = user,
- from_user = update_activity.user,
- post = post,
- update_type = update_type,
- template = template,
- )
+ to_user = user,
+ from_user = update_activity.user,
+ post = post,
+ update_type = update_type,
+ template = template,
+ )
+
#todo: this could be packaged as an "action" - a bundle
#of executive function with the activity log recording
#TODO check user reputation
@@ -2345,6 +2349,8 @@ def send_instant_notifications_about_activity_in_post(
)
+
+
#todo: move to utils
def calculate_gravatar_hash(instance, **kwargs):
"""Calculates a User's gravatar hash from their email address."""
diff --git a/askbot/skins/default/templates/instant_notification_reply_by_email.html b/askbot/skins/default/templates/instant_notification_reply_by_email.html
index 84506143..ffb43110 100644
--- a/askbot/skins/default/templates/instant_notification_reply_by_email.html
+++ b/askbot/skins/default/templates/instant_notification_reply_by_email.html
@@ -1,7 +1,14 @@
+
+{% if can_reply %}
{% trans %}
{# Don't change the following line in the template. #}
======= Reply above this line. ====-=-=
-You can post an answer or a comment by replying to this email. To reply to this email
+{% endtrans %}
+{% else %}
+{% trans %}
+You can post an answer or a comment by replying to email notifications. To do that
you need {{reply_by_email_karma_threshold}} karma, you have {{receiving_user_karma}} karma.
{% endtrans %}
+{% endif %}
+
{% include 'instant_notification.html' %} \ No newline at end of file