diff options
-rw-r--r-- | askbot/models/__init__.py | 29 | ||||
-rw-r--r-- | askbot/models/base.py | 2 | ||||
-rw-r--r-- | askbot/models/post.py | 4 | ||||
-rw-r--r-- | askbot/models/question.py | 4 | ||||
-rw-r--r-- | askbot/skins/default/templates/email/welcome_lamson_off.html | 11 |
5 files changed, 34 insertions, 16 deletions
diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py index ef980a37..e9535c4b 100644 --- a/askbot/models/__init__.py +++ b/askbot/models/__init__.py @@ -3259,22 +3259,29 @@ def send_respondable_email_validation_message( ) -def send_welcome_email(user, **kwargs): +def greet_new_user(user, **kwargs): """sends welcome email to the newly created user todo: second branch should send email with a simple clickable link. """ + if askbot_settings.NEW_USER_GREETING: + user.message_set.create(message = askbot_settings.NEW_USER_GREETING) + if askbot_settings.REPLY_BY_EMAIL:#with this on we also collect signature - data = { - 'site_name': askbot_settings.APP_SHORT_NAME - } - send_respondable_email_validation_message( - user = user, - subject_line = _('Welcome to %(site_name)s') % data, - data = data, - template_name = 'email/welcome_lamson_on.html' - ) + template_name = 'email/welcome_lamson_on.html' + else: + template_name = 'email/welcome_lamson_off.html' + + data = { + 'site_name': askbot_settings.APP_SHORT_NAME + } + send_respondable_email_validation_message( + user = user, + subject_line = _('Welcome to %(site_name)s') % data, + data = data, + template_name = template_name + ) def complete_pending_tag_subscriptions(sender, request, *args, **kwargs): @@ -3361,7 +3368,7 @@ signals.delete_question_or_answer.connect(record_delete_question, sender=Post) signals.flag_offensive.connect(record_flag_offensive, sender=Post) signals.remove_flag_offensive.connect(remove_flag_offensive, sender=Post) signals.tags_updated.connect(record_update_tags) -signals.user_registered.connect(send_welcome_email) +signals.user_registered.connect(greet_new_user) signals.user_updated.connect(record_user_full_updated, sender=User) signals.user_logged_in.connect(complete_pending_tag_subscriptions)#todo: add this to fake onlogin middleware signals.user_logged_in.connect(post_anonymous_askbot_content) diff --git a/askbot/models/base.py b/askbot/models/base.py index b3a12fbf..74b8c2dd 100644 --- a/askbot/models/base.py +++ b/askbot/models/base.py @@ -41,7 +41,7 @@ class BaseQuerySetManager(models.Manager): return getattr(self.get_query_set(), attr, *args) -class AnonymousContent(models.Model): +class DraftContent(models.Model): """Base class for AnonymousQuestion and AnonymousAnswer""" session_key = models.CharField(max_length=40) #session id for anonymous questions wiki = models.BooleanField(default=False) diff --git a/askbot/models/post.py b/askbot/models/post.py index 03329fa5..b61be5ed 100644 --- a/askbot/models/post.py +++ b/askbot/models/post.py @@ -31,7 +31,7 @@ from askbot.conf import settings as askbot_settings from askbot import exceptions from askbot.utils import markup from askbot.utils.html import sanitize_html -from askbot.models.base import BaseQuerySetManager, AnonymousContent +from askbot.models.base import BaseQuerySetManager, DraftContent #todo: maybe merge askbot.utils.markup and forum.utils.html from askbot.utils.diff import textDiff as htmldiff @@ -1989,7 +1989,7 @@ class PostFlagReason(models.Model): app_label = 'askbot' -class AnonymousAnswer(AnonymousContent): +class AnonymousAnswer(DraftContent): question = models.ForeignKey(Post, related_name='anonymous_answers') def publish(self, user): diff --git a/askbot/models/question.py b/askbot/models/question.py index e87fcaa0..b922c82d 100644 --- a/askbot/models/question.py +++ b/askbot/models/question.py @@ -18,7 +18,7 @@ from askbot.mail import messages from askbot.models.tag import Tag, get_groups, get_tags_by_names from askbot.models.tag import filter_accepted_tags, filter_suggested_tags from askbot.models.tag import delete_tags, separate_unused_tags -from askbot.models.base import AnonymousContent, BaseQuerySetManager +from askbot.models.base import DraftContent, BaseQuerySetManager from askbot.models.tag import Tag, get_groups from askbot.models.post import Post, PostRevision from askbot.models import signals @@ -1068,7 +1068,7 @@ class FavoriteQuestion(models.Model): return '[%s] favorited at %s' %(self.user, self.added_at) -class AnonymousQuestion(AnonymousContent): +class AnonymousQuestion(DraftContent): """question that was asked before logging in maybe the name is a little misleading, the user still may or may not want to stay anonymous after the question diff --git a/askbot/skins/default/templates/email/welcome_lamson_off.html b/askbot/skins/default/templates/email/welcome_lamson_off.html new file mode 100644 index 00000000..d1b9854d --- /dev/null +++ b/askbot/skins/default/templates/email/welcome_lamson_off.html @@ -0,0 +1,11 @@ +{% import "email/macros.html" as macros %} +{# site_name - is short name of the site, email_code - address portion +of the reply email used for this message, we scan to the last appearance +of the email code to detect the response signature that will appear under #} +<p style="{{ macros.heading_style() }}"> + {% trans %}Welcome to {{ site_name }}!{% endtrans %} +</p> +<p> + {% trans %}We look forward to your Questions!{% endtrans %} +</p> +{% include "email/footer.html" %} |