[openstreetmap/openstreetmap-website] Show hidden comments to moderators if requested (PR #4251)

Anton Khorev notifications at github.com
Sun Sep 17 15:51:16 UTC 2023


Continuation of https://github.com/openstreetmap/openstreetmap-website/pull/4245.

With comment ids shown it's possible to hide specific comments. But the unhiding also requires comment ids. They are not known because the comments are hidden from the api calls.

Here a parameter is added to show hidden comments. It makes hidden comments visible to users who can unhide comments. The request looks like this:

```
/api/0.6/changeset/<id>?include_discussion=true&show_hidden_comments=true
```

I chose to add a parameter instead of showing the comments to anyone with permissions in case there are too many hidden comments. Maybe later some kind of limit will be added, making changeset with discussion requests to look like search requests. In this case `show_hidden_comments` would act similar to filters like `closed` for changesets/notes.

The `visible` attribute is added to each comment to indicate if it's hidden. See also https://github.com/zerebubuth/openstreetmap-cgimap/pull/289#issuecomment-1722363471.

See #3934 for why the parameter is named `show_hidden_...` I added `_comments` at the end in case there's something else to be hidden in changeset metadata. This allows for tags or bbox hiding to be added later if necessary.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/4251

-- Commit Summary --

  * Show hidden comments to moderators if requested

-- File Changes --

    M app/controllers/api/changesets_controller.rb (7)
    M app/views/api/changesets/_changeset.json.jbuilder (5)
    M app/views/api/changesets/_changeset.xml.builder (7)
    M test/controllers/api/changesets_controller_test.rb (174)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/4251.patch
https://github.com/openstreetmap/openstreetmap-website/pull/4251.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4251
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/4251 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20230917/71865e7b/attachment.htm>


More information about the rails-dev mailing list