-
Notifications
You must be signed in to change notification settings - Fork 927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notes throw errors if there are no visible comments #3450
Comments
I thought I tested a scenario where all notes were hidden, and I don't remember seeing an error message for non-moderators. Hmm. |
Good point. What would be your suggestion here? Should the new API endpoint block any attempts to delete the first comment? # Find the note comment
comment = NoteComment.find(id)
# Opening comment cannot be hidden
raise OSM::APIBadUserInput, "Cannot hide id" if comment.event == "opened"
# Hide the comment
comment.update(:visible => false) |
I don't know. I think relying on the fact that the first comment has the "opened" event, and that there's no other "opened" events, seems fragile - but I'm not entirely sure why I feel that. But maybe that's a workaround until we sort things out properly? |
Hmm. An "opened" event is used exclusively when creating a new note. https://github.com/openstreetmap/openstreetmap-website/blob/master/app/controllers/api/notes_controller.rb#L76 I think what needs to be clarified first is whether we want the opening event to be hidden at all. Depending on this decision other parts of the code need to be adjusted to handle this case properly. |
I've moved the discussion of the "opened" comment to the PR in #3438 , since this issue is to deal with the wider problems of the current implementation. |
It's not possible to view a note if there are no visible comments. This can come about either:
In both cases, you get errors, albeit different ones in each case. But the point remains that there's a lot of (untested) logic that assumes there's at least one note comment visible.
Related:
The text was updated successfully, but these errors were encountered: