diff options
Diffstat (limited to 'forum/models')
-rw-r--r-- | forum/models/answer.py | 3 | ||||
-rw-r--r-- | forum/models/base.py | 11 | ||||
-rw-r--r-- | forum/models/content.py | 1 | ||||
-rw-r--r-- | forum/models/question.py | 2 |
4 files changed, 11 insertions, 6 deletions
diff --git a/forum/models/answer.py b/forum/models/answer.py index 48b1c464..b4e8963e 100644 --- a/forum/models/answer.py +++ b/forum/models/answer.py @@ -172,6 +172,9 @@ class Answer(content.Content, DeletableContent): include_comments = True ) ) + for answer in self.question.answers.all(): + receiving_users.update(answer.get_author_list()) + receiving_users -= set(exclude_list) return list(receiving_users) diff --git a/forum/models/base.py b/forum/models/base.py index 964c6142..d832b71c 100644 --- a/forum/models/base.py +++ b/forum/models/base.py @@ -126,11 +126,12 @@ def save_post(post, **kwargs): #create new mentions for u in newly_mentioned_users: from forum.models.user import Activity - Activity.objects.create_new_mention( - mentioned_whom = u, - mentioned_in = post, - mentioned_by = last_author - ) + if u != last_author: + Activity.objects.create_new_mention( + mentioned_whom = u, + mentioned_in = post, + mentioned_by = last_author + ) #todo: this is handled in signal because models for posts #are too spread out diff --git a/forum/models/content.py b/forum/models/content.py index 441f7133..eb2b423e 100644 --- a/forum/models/content.py +++ b/forum/models/content.py @@ -75,6 +75,7 @@ class Content(models.Model): comment.save() self.comment_count = self.comment_count + 1 self.save() + return comment def get_instant_notification_subscribers( self, diff --git a/forum/models/question.py b/forum/models/question.py index 88f01e4f..c6c16578 100644 --- a/forum/models/question.py +++ b/forum/models/question.py @@ -437,7 +437,7 @@ class Question(content.Content, DeletableContent): def add_revision(self,author=None, text=None, comment=None, revised_at=None): if None in (author, text, comment): - raise Exception('author, text and revised_at are required arguments') + raise Exception('author, text and comment are required arguments') rev_no = self.revisions.all().count() + 1 if comment in (None, ''): if rev_no == 1: |