summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-10-07 12:17:30 -0300
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-10-07 12:17:30 -0300
commitd6d0f6ff6458e80ad5de0e4e21f2d01ca8ad978e (patch)
treee79736f2979be9cf0ba6eb0d72c689f3ac744a94
parentbcdc986552c66639606ed5e7e9956822b5136801 (diff)
downloadaskbot-d6d0f6ff6458e80ad5de0e4e21f2d01ca8ad978e.tar.gz
askbot-d6d0f6ff6458e80ad5de0e4e21f2d01ca8ad978e.tar.bz2
askbot-d6d0f6ff6458e80ad5de0e4e21f2d01ca8ad978e.zip
fixed the duplicate menttion&response in the inbox bug102
-rw-r--r--askbot/tasks.py16
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)):