summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-10-06 17:27:41 -0300
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-10-06 17:27:41 -0300
commitbcdc986552c66639606ed5e7e9956822b5136801 (patch)
treee83d82c370b4dfe1b629c07101c3d7578c72a704
parent115e4b6316c7821f03abf14211551ea0269ea2aa (diff)
downloadaskbot-bcdc986552c66639606ed5e7e9956822b5136801.tar.gz
askbot-bcdc986552c66639606ed5e7e9956822b5136801.tar.bz2
askbot-bcdc986552c66639606ed5e7e9956822b5136801.zip
moved mention savings to the celery job and now many test cases for email alerts fail
-rw-r--r--askbot/models/base.py10
-rw-r--r--askbot/tasks.py16
-rw-r--r--askbot/tests/on_screen_notification_tests.py2
3 files changed, 17 insertions, 11 deletions
diff --git a/askbot/models/base.py b/askbot/models/base.py
index 80572b86..b456bca8 100644
--- a/askbot/models/base.py
+++ b/askbot/models/base.py
@@ -134,16 +134,6 @@ def parse_and_save_post(post, author = None, **kwargs):
timestamp = post.get_time_of_last_edit()
- #create new mentions
- for u in newly_mentioned_users:
- from askbot.models.user import Activity
- Activity.objects.create_new_mention(
- mentioned_whom = u,
- mentioned_in = post,
- mentioned_by = author,
- mentioned_at = timestamp
- )
-
#todo: this is handled in signal because models for posts
#are too spread out
from askbot.models import signals
diff --git a/askbot/tasks.py b/askbot/tasks.py
index b0ac5356..0a238df1 100644
--- a/askbot/tasks.py
+++ b/askbot/tasks.py
@@ -100,7 +100,21 @@ def record_post_update(
exclude_list = [updated_by, ]
)
- update_activity.add_recipients(recipients)
+ #create new mentions
+ for u in newly_mentioned_users:
+ from askbot.models.user import Activity
+ Activity.objects.create_new_mention(
+ mentioned_whom = u,
+ mentioned_in = post,
+ mentioned_by = updated_by,
+ 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)
diff --git a/askbot/tests/on_screen_notification_tests.py b/askbot/tests/on_screen_notification_tests.py
index 574f4e5e..0d668542 100644
--- a/askbot/tests/on_screen_notification_tests.py
+++ b/askbot/tests/on_screen_notification_tests.py
@@ -244,6 +244,8 @@ class OnScreenUpdateNotificationTests(TestCase):
)
def test_self_comments(self):
+ """poster of the question or answer adds a comment
+ under the corresponding question or answer"""
self.reset_response_counts()
time.sleep(1)
timestamp = datetime.datetime.now()