diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2014-08-25 16:26:58 +0700 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2014-08-25 16:26:58 +0700 |
commit | 7fa1eb17f907fe5c3878a331960cdd59217db43c (patch) | |
tree | dbbb030efcc3e3e8a42f98149bc8a3f577070797 /askbot/models/badges.py | |
parent | c11627a6386f0b3568dea83f98f423194efb835c (diff) | |
download | askbot-7fa1eb17f907fe5c3878a331960cdd59217db43c.tar.gz askbot-7fa1eb17f907fe5c3878a331960cdd59217db43c.tar.bz2 askbot-7fa1eb17f907fe5c3878a331960cdd59217db43c.zip |
fixed correctness issue in the CivicDuty badge awards and allowed to edit comments by high reputation users
Diffstat (limited to 'askbot/models/badges.py')
-rw-r--r-- | askbot/models/badges.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/askbot/models/badges.py b/askbot/models/badges.py index 44eda0c3..58a4a978 100644 --- a/askbot/models/badges.py +++ b/askbot/models/badges.py @@ -84,7 +84,9 @@ class Badge(object): return dict(const.BADGE_TYPE_CHOICES).get(self.level) def award(self, recipient = None, context_object = None, timestamp = None): - """do award, the recipient was proven to deserve""" + """do award, the recipient was proven to deserve, + Returns True, if awarded, or False + """ from askbot.models.repute import Award if self.multiple == False: if recipient.badges.filter(slug = self.key).count() != 0: @@ -244,10 +246,12 @@ class CivicDuty(Badge): def consider_award(self, actor = None, context_object = None, timestamp = None): - if context_object.post_type not in ('question', 'answer'): + + obj = context_object + if not (obj.is_question() or obj.is_answer() or obj.is_comment()): return False - if actor.votes.count() == askbot_settings.CIVIC_DUTY_BADGE_MIN_VOTES: - return self.award(actor, context_object, timestamp) + if actor.votes.count() >= askbot_settings.CIVIC_DUTY_BADGE_MIN_VOTES: + return self.award(actor, obj, timestamp) class SelfLearner(Badge): def __init__(self): |