Exemple #1
0
def watch_forum(request, forum_slug):
    """Watch/unwatch a forum (based on 'watch' POST param)."""
    forum = get_object_or_404(Forum, slug=forum_slug)
    if not forum.allows_viewing_by(request.user):
        raise Http404

    if request.POST.get("watch") == "yes":
        NewThreadEvent.notify(request.user, forum)
    else:
        NewThreadEvent.stop_notifying(request.user, forum)

    return HttpResponseRedirect(reverse("forums.threads", args=[forum_slug]))
Exemple #2
0
def watch_forum(request, forum_slug):
    """Watch/unwatch a forum (based on 'watch' POST param)."""
    forum = get_object_or_404(Forum, slug=forum_slug)
    if not forum.allows_viewing_by(request.user):
        raise Http404

    if request.POST.get('watch') == 'yes':
        NewThreadEvent.notify(request.user, forum)
        statsd.incr('forums.watches.forum')
    else:
        NewThreadEvent.stop_notifying(request.user, forum)

    return HttpResponseRedirect(reverse('forums.threads', args=[forum_slug]))
Exemple #3
0
 def test_delete_removes_watches(self):
     f = forum(save=True)
     NewThreadEvent.notify('*****@*****.**', f)
     assert NewThreadEvent.is_notifying('*****@*****.**', f)
     f.delete()
     assert not NewThreadEvent.is_notifying('*****@*****.**', f)
Exemple #4
0
 def test_delete_removes_watches(self):
     f = forum(save=True)
     NewThreadEvent.notify('*****@*****.**', f)
     assert NewThreadEvent.is_notifying('*****@*****.**', f)
     f.delete()
     assert not NewThreadEvent.is_notifying('*****@*****.**', f)
Exemple #5
0
 def test_delete_removes_watches(self):
     f = ForumFactory()
     NewThreadEvent.notify('*****@*****.**', f)
     assert NewThreadEvent.is_notifying('*****@*****.**', f)
     f.delete()
     assert not NewThreadEvent.is_notifying('*****@*****.**', f)
Exemple #6
0
 def test_delete_removes_watches(self):
     f = ForumFactory()
     NewThreadEvent.notify('*****@*****.**', f)
     assert NewThreadEvent.is_notifying('*****@*****.**', f)
     f.delete()
     assert not NewThreadEvent.is_notifying('*****@*****.**', f)