diff options
-rw-r--r-- | askbot/tasks.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/askbot/tasks.py b/askbot/tasks.py index 0a238df1..465465ef 100644 --- a/askbot/tasks.py +++ b/askbot/tasks.py @@ -41,7 +41,6 @@ def record_post_update_celery_task( id__in = newly_mentioned_user_id_list ) - record_post_update( post = post, updated_by = updated_by, @@ -71,7 +70,6 @@ def record_post_update( * records "red envelope" recipients of the post * sends email alerts to all subscribers to the post """ - #todo: take into account created == True case (activity_type, update_object) = post.get_updated_activity_data(created) @@ -99,10 +97,16 @@ def record_post_update( recipients = post.get_response_receivers( exclude_list = [updated_by, ] ) + update_activity.add_recipients(recipients) #create new mentions for u in newly_mentioned_users: - from askbot.models.user import Activity + #todo: a hack - some users will not have record of a mention + #may need to fix this in the future. Added this so that + #recipients of the response who are mentioned as well would + #not get two notifications in the inbox for the same post + if u in recipients: + continue Activity.objects.create_new_mention( mentioned_whom = u, mentioned_in = post, @@ -110,12 +114,6 @@ def record_post_update( mentioned_at = timestamp ) - #we don't want to save a mention and a separate notification - #about the response - update_activity.add_recipients( - recipients# - set(newly_mentioned_users) - ) - assert(updated_by not in recipients) for user in (set(recipients) | set(newly_mentioned_users)): |