[openstreetmap/openstreetmap-website] Add show user block api endpoint (PR #4240)

Anton Khorev notifications at github.com
Fri Sep 8 13:36:36 UTC 2023


Going through the DWG Wishlist, there was a blocks api.

Currently scripted blocks in [osmtools](https://github.com/woodpeck/osm-revert-scripts) are done by emulating the browser, loading webpages and filling out forms. That requires passing the password around. It would be better to be able to access block functionality with a proper api and an oauth token.

But before doing block creation, there need to be block read api endpoints. Here the xml block show method is added at `/api/0.6/user_blocks/:id` with an output like:

```
<osm version="0.6" ...>
<user_block id="6" created_at="2023-08-01T15:55:58Z" updated_at="2023-08-05T00:46:36Z" ends_at="2023-08-05T00:46:36Z" needs_view="false">
  <user uid="1" user="fakeuser1"/>
  <creator uid="2" user="fakemod1"/>
  <revoker uid="2" user="fakemod1"/>
  <reason>longer block test</reason>
</user_block>
</osm>
```

All of this is already accessible through the web ui at `/user_blocks/:id`.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Add show user block api endpoint

-- File Changes --

    M app/abilities/api_ability.rb (1)
    A app/controllers/api/user_blocks_controller.rb (18)
    A app/views/api/user_blocks/_user_block.xml.builder (14)
    A app/views/api/user_blocks/show.xml.builder (5)
    M config/routes.rb (2)
    A test/controllers/api/user_blocks_controller_test.rb (30)

-- Patch Links --

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

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

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


More information about the rails-dev mailing list