Esempio n. 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]))
Esempio n. 2
0
 def test_delete_removes_watches(self):
     f = Forum.objects.get(pk=1)
     NewThreadEvent.notify('*****@*****.**', f)
     assert NewThreadEvent.is_notifying('*****@*****.**', f)
     f.delete()
     assert not NewThreadEvent.is_notifying('*****@*****.**', f)
Esempio n. 3
0
 def test_delete_removes_watches(self):
     f = Forum.objects.get(pk=1)
     NewThreadEvent.notify('*****@*****.**', f)
     assert NewThreadEvent.is_notifying('*****@*****.**', f)
     f.delete()
     assert not NewThreadEvent.is_notifying('*****@*****.**', f)
Esempio n. 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)
Esempio n. 5
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)