diff options
-rw-r--r-- | askbot/models/__init__.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py index 3774bc7d..14989adb 100644 --- a/askbot/models/__init__.py +++ b/askbot/models/__init__.py @@ -263,6 +263,12 @@ def user_can_have_strong_url(self): followed by the search engine crawlers""" return (self.reputation >= askbot_settings.MIN_REP_TO_HAVE_STRONG_URL) +def user_can_reply_by_email(self): + """True, if reply by email is enabled + and user has sufficient reputatiton""" + return askbot_settings.REPLY_BY_EMAIL and \ + self.reputation > askbot_settings.MIN_REP_TO_POST_BY_EMAIL + def _assert_user_can( user = None, post = None, #related post (may be parent) @@ -2345,6 +2351,7 @@ User.add_to_class('is_following_question', user_is_following_question) User.add_to_class('mark_tags', user_mark_tags) User.add_to_class('update_response_counts', user_update_response_counts) User.add_to_class('can_have_strong_url', user_can_have_strong_url) +User.add_to_class('can_reply_by_email', user_can_reply_by_email) User.add_to_class('can_post_comment', user_can_post_comment) User.add_to_class('is_administrator', user_is_administrator) User.add_to_class('is_administrator_or_moderator', user_is_administrator_or_moderator) @@ -2509,7 +2516,7 @@ def format_instant_notification_email( 'post_link': '<a href="%s">%s</a>' % (post_url, _(post.post_type)) } - can_reply = to_user.reputation > askbot_settings.MIN_REP_TO_POST_BY_EMAIL + can_reply = to_user.can_reply_by_email() if can_reply: reply_separator = const.REPLY_SEPARATOR_TEMPLATE % { |