From 7fb2c2c91867891e105c6bbd370e4aecdd98c7f1 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Wed, 24 Apr 2013 01:59:34 -0400 Subject: improved user welcoming templates --- askbot/mail/lamson_handlers.py | 3 ++- askbot/models/__init__.py | 15 ++++++++++----- askbot/templates/email/re_welcome_lamson_on.html | 18 +++++++++++------- askbot/templates/email/welcome_lamson_off.html | 2 +- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/askbot/mail/lamson_handlers.py b/askbot/mail/lamson_handlers.py index 81dd997f..0bc828c5 100644 --- a/askbot/mail/lamson_handlers.py +++ b/askbot/mail/lamson_handlers.py @@ -246,7 +246,8 @@ def VALIDATE_EMAIL( data = { 'site_name': askbot_settings.APP_SHORT_NAME, 'site_url': askbot_settings.APP_URL, - 'ask_address': 'ask@' + askbot_settings.REPLY_BY_EMAIL_HOSTNAME + 'ask_address': 'ask@' + askbot_settings.REPLY_BY_EMAIL_HOSTNAME, + 'can_post_by_email': user.can_post_by_email() } template = get_template('email/re_welcome_lamson_on.html') diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py index 614e3c76..cb6ccbef 100644 --- a/askbot/models/__init__.py +++ b/askbot/models/__init__.py @@ -461,6 +461,8 @@ def user_can_have_strong_url(self): def user_can_post_by_email(self): """True, if reply by email is enabled and user has sufficient reputatiton""" + if self.is_administrator_or_moderator(): + return True return askbot_settings.REPLY_BY_EMAIL and \ self.reputation > askbot_settings.MIN_REP_TO_POST_BY_EMAIL @@ -3600,13 +3602,16 @@ def greet_new_user(user, **kwargs): template_name = 'email/welcome_lamson_off.html' data = { - 'site_name': askbot_settings.APP_SHORT_NAME + 'site_name': askbot_settings.APP_SHORT_NAME, + 'site_url': askbot_settings.APP_URL, + 'ask_address': 'ask@' + askbot_settings.REPLY_BY_EMAIL_HOSTNAME, + 'can_post_by_email': user.can_post_by_email() } send_respondable_email_validation_message( - user = user, - subject_line = _('Welcome to %(site_name)s') % data, - data = data, - template_name = template_name + user=user, + subject_line=_('Welcome to %(site_name)s') % data, + data=data, + template_name=template_name ) diff --git a/askbot/templates/email/re_welcome_lamson_on.html b/askbot/templates/email/re_welcome_lamson_on.html index d2c7884c..f30345d1 100644 --- a/askbot/templates/email/re_welcome_lamson_on.html +++ b/askbot/templates/email/re_welcome_lamson_on.html @@ -2,12 +2,16 @@ {% block headline %}{% trans %}Great, you are ready to use {{ site_name }}!{% endtrans %}{%endblock%} {% block title %}{% trans %}Great, you are ready to use {{ site_name }}!{% endtrans %}{%endblock%} -{%block content %} -

{% trans %}You can post questions by emailing them at {{ ask_address }}.{% endtrans %}

-

{% trans %}When you receive update notifications, you will be able to respond to them, also by email.{% endtrans %}

-

{% trans %}Of course, you can always visit the {{ site_name }} at {{ site_url }}{% endtrans %}

-{%endblock%} +{% block content %} +{% if can_post_by_email %} +

{% trans %}You can post questions by emailing them at {{ ask_address }}.{% endtrans %}

+

{% trans %}When you receive update notifications, you will be able to respond to them, also by email.{% endtrans %}

+

{% trans %}Of course, you can always visit the {{ site_name }} at {{ site_url }}.{% endtrans %}

+{% else %} +

{% trans %}Please visit {{ site_name }} at {{ site_url }}, we look forward to your posts.{% endtrans %}

+{% endif %} +{% endblock %} -{%block footer%} +{% block footer %} {% include "email/footer.html" %} -{%endblock%} +{% endblock %} diff --git a/askbot/templates/email/welcome_lamson_off.html b/askbot/templates/email/welcome_lamson_off.html index c5c9384c..1be7b9a1 100644 --- a/askbot/templates/email/welcome_lamson_off.html +++ b/askbot/templates/email/welcome_lamson_off.html @@ -7,7 +7,7 @@ of the email code to detect the response signature that will appear under #} {%block headline%} {% trans %}Welcome to {{ site_name }}!{% endtrans %} {%endblock%} {%block content%}

- {% trans %}We look forward to your Questions!{% endtrans %} +

{% trans %}Please visit {{ site_name }} at {{ site_url }}, we look forward to your posts.{% endtrans %}

{%endblock%} {%block footer %} -- cgit v1.2.3-1-g7c22