[openstreetmap/openstreetmap-website] Use shallow routes for diary comments (PR #5093)

Anton Khorev notifications at github.com
Sat Aug 17 12:19:49 UTC 2024


Changes routes from 

`/user/:display_name/diary/:id/comments/:comment/hide`

to

`/diary_comments/:comment/hide`

\+ the same for unhide.

This is what you'll get if you define comments as a shallow nested resource like this:

```ruby
  resources :users, :path => "user", :param => :display_name do
    resources :diary_entries, :path => "diary" do
      resources :diary_comments, :shallow => true, :only => [] do
        ...
      end
    end
  end
```

Paths with display_name and diary entry id are too long and these names/ids are not used for anything in the controller.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Use shallow routes for diary comments

-- File Changes --

    M app/views/diary_entries/_diary_comment.html.erb (4)
    M config/routes.rb (4)
    M test/controllers/diary_comments_controller_test.rb (24)

-- Patch Links --

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

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

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


More information about the rails-dev mailing list