[openstreetmap/openstreetmap-website] Remove current user check from dashboard view (PR #5705)

Anton Khorev notifications at github.com
Wed Feb 19 01:09:35 UTC 2025


Dashboard view only outputs its contents if this condition is true:

```ruby
if current_user and @user.id == current_user.id
```

But it's always true. The page is only accessible when authorized, therefore `current_user` is set. `current_user` is assigned to `@user`, so the `id`s are also always equal. That makes `@user` unnecessary and the entire check unnecessary.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Initialize dashboard followings and nearby users in controller
  * Remove current user check from dashboard view

-- File Changes --

    M app/controllers/dashboards_controller.rb (3)
    M app/views/dashboards/_contact.html.erb (4)
    M app/views/dashboards/show.html.erb (101)
    M test/controllers/dashboards_controller_test.rb (6)

-- Patch Links --

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

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

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


More information about the rails-dev mailing list