summaryrefslogtreecommitdiffstats
path: root/askbot/models/badges.py
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2014-08-25 16:26:58 +0700
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2014-08-25 16:26:58 +0700
commit7fa1eb17f907fe5c3878a331960cdd59217db43c (patch)
treedbbb030efcc3e3e8a42f98149bc8a3f577070797 /askbot/models/badges.py
parentc11627a6386f0b3568dea83f98f423194efb835c (diff)
downloadaskbot-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.py12
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):