aboutsummaryrefslogtreecommitdiffstats
path: root/servo
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2016-05-10 15:24:26 +0300
committerFilipp Lepalaan <filipp@mac.com>2016-05-10 15:24:26 +0300
commit9e5f553863749b5bb0a83e597b2f962b0d91e442 (patch)
tree5956ef3ea1abed37cb60e0ef971f044fe9e7a940 /servo
parentbb1fa8e854882e60909386ddade466981ce65c02 (diff)
downloadServo-9e5f553863749b5bb0a83e597b2f962b0d91e442.tar.gz
Servo-9e5f553863749b5bb0a83e597b2f962b0d91e442.tar.bz2
Servo-9e5f553863749b5bb0a83e597b2f962b0d91e442.zip
Fix for flag toggling
Diffstat (limited to 'servo')
-rw-r--r--servo/urls/note.py4
-rw-r--r--servo/views/note.py5
2 files changed, 6 insertions, 3 deletions
diff --git a/servo/urls/note.py b/servo/urls/note.py
index e68bba3..5cab498 100644
--- a/servo/urls/note.py
+++ b/servo/urls/note.py
@@ -19,7 +19,9 @@ urlpatterns = [
name="notes-create_to_customer"),
url(r'^(?P<pk>\d+)/toggle/tag/(?P<tag_id>\d+)/$', toggle_tag,
name="notes-toggle_tag"),
- url(r'^(?P<kind>\w+)?/(?P<pk>\d+)/toggle_(?P<flag>[a-z]+)/$', toggle_flag,
+ url(r'^(?P<kind>\w+)/(?P<pk>\d+)/toggle_(?P<flag>[a-z]+)/$', toggle_flag,
+ name="notes-toggle_flag"),
+ url(r'^all/(?P<pk>\d+)/toggle_(?P<flag>[a-z]+)/$', toggle_flag,
name="notes-toggle_flag"),
url(r'^(?P<parent>\d+)/reply/$', edit, name="notes-reply"),
url(r'^(?P<pk>\d+)/edit/$', edit, name="notes-edit"),
diff --git a/servo/views/note.py b/servo/views/note.py
index 162b297..c3b0b99 100644
--- a/servo/views/note.py
+++ b/servo/views/note.py
@@ -287,6 +287,9 @@ def templates(request, template_id=None):
def toggle_flag(request, kind, pk, flag):
+ """
+ Toggles a flag of a note (read/unread, flagged/not, reported/not)
+ """
if kind == 'articles':
note = get_object_or_404(Article, pk=pk)
if flag == 'flagged':
@@ -296,8 +299,6 @@ def toggle_flag(request, kind, pk, flag):
note.toggle_read(request.user)
return HttpResponse(note.get_read_title(request.user))
- return HttpResponse(getattr(note, 'get_%s_title' % flag)())
-
field = 'is_%s' % flag
note = get_object_or_404(Note, pk=pk)
attr = getattr(note, field)