DemokratieInBewegung / plenum

The Voting Platform of DEMOKRATIE IN BEWEGUNG:
http://abstimmen.dib.de
GNU Affero General Public License v3.0
20 stars 3 forks source link

commenting on moderation comment causes exception #119

Open joriki opened 6 years ago

joriki commented 6 years ago

Trying to comment on a moderation comment causes the following exception:

POST /comment/moderation/30?fragment=%23moderation-30-new-comment 500 INTERNAL SERVER ERROR PermissionDenied No exception message supplied [...] Traceback:
File "/Users/joriki/DiB/devel/3.6/abstimmungstool/lib/python3.6/site-packages/django_ajax/decorators.py" in inner

  1. return render_to_json(func(request, *args, kwargs), ajax_kwargs) File "/Users/joriki/DiB/devel/3.6/abstimmungstool/lib/python3.6/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  2. return view_func(request, *args, **kwargs) File "/Users/joriki/DiB/devel/3.6/abstimmungstool/voty/initproc/forms.py" in view
  3. return fn(request, form, *args, **kwargs) File "/Users/joriki/DiB/devel/3.6/abstimmungstool/voty/initproc/views.py" in comment
  4. raise PermissionDenied() Exception Type: PermissionDenied Request data not supplied
joriki commented 6 years ago

More specifically, this only happens if you try to comment when the rule for comments doesn't allow it (i.e. when you're the last person to have written (either commented or originated the thread)). This permission is checked only upon submitting the comment, not upon displaying the comment button.

We need to decide whether this rule should actually apply to moderations. I don't think it should; it seems like it's being applied simply because the comments for arguments and proposals were reused. Those are written in a public context where we want to encourage interactive discussion by limiting monologues; in the context of the review team, it might be that new information comes to light and a team member wants to comment on their own evaluation of the initiative.

tizip commented 6 years ago

I agree that moderation should not be limited to "other people's comments", but should always be allowed.

gnunicorn commented 6 years ago

Yes, let's check the comment a bit more distinctly: moderations should be allowed to double comment

joriki commented 6 years ago

I fixed this by simply bypassing the check for repeated comments if the object is an instance of Moderation. I'm not sure how stylish this is, but I think it's good enough for now :-)