summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei <mamoutkine@gmail.com>2011-04-07 17:17:13 -0400
committerAndrei <mamoutkine@gmail.com>2011-04-07 17:17:13 -0400
commitcbd388912e6627e5eddc429752fea3e5509ff175 (patch)
tree33255a5958b70987932d16e557e63ef2ddcdfded
parentb75274049dfa15ed470115b11e1d03e1bb3776ef (diff)
downloadaskbot-cbd388912e6627e5eddc429752fea3e5509ff175.tar.gz
askbot-cbd388912e6627e5eddc429752fea3e5509ff175.tar.bz2
askbot-cbd388912e6627e5eddc429752fea3e5509ff175.zip
fixed a bug where Content.get_global_tag_based_subscribers threw exception when user dislikes a wildcard tag and some tag matching the same wildcard
-rw-r--r--askbot/models/content.py2
-rw-r--r--askbot/tests/db_api_tests.py16
2 files changed, 17 insertions, 1 deletions
diff --git a/askbot/models/content.py b/askbot/models/content.py
index 3ce219ed..02554a69 100644
--- a/askbot/models/content.py
+++ b/askbot/models/content.py
@@ -144,7 +144,7 @@ class Content(models.Model):
elif tag_mark_reason == 'bad':
empty_wildcard_filter = {'ignored_tags__exact': ''}
wildcard_tags_attribute = 'ignored_tags'
- update_subscribers = lambda the_set, item: the_set.remove(item)
+ update_subscribers = lambda the_set, item: the_set.discard(item)
potential_wildcard_subscribers = User.objects.filter(
notification_subscriptions__in = subscription_records
diff --git a/askbot/tests/db_api_tests.py b/askbot/tests/db_api_tests.py
index a6b2dfc4..ac438f7c 100644
--- a/askbot/tests/db_api_tests.py
+++ b/askbot/tests/db_api_tests.py
@@ -322,3 +322,19 @@ class GlobalTagSubscriberGetterTests(AskbotTestCase):
expected_subscribers = set([self.u2,]),
reason = 'bad'
)
+
+ def test_user_dislikes_wildcard_and_matching_tag(self):
+ """user ignores tag "day" and ignores a wildcard "da*"
+ """
+ self.set_email_tag_filter_strategy(const.EXCLUDE_IGNORED)
+ askbot_settings.update('USE_WILDCARD_TAGS', True)
+ self.u1.mark_tags(
+ tagnames = ('day',),
+ wildcards = ('da*',),
+ reason = 'bad',
+ action = 'add'
+ )
+ self.assert_subscribers_are(
+ expected_subscribers = set([self.u2,]),
+ reason = 'bad'
+ )