[openstreetmap/openstreetmap-website] Add navigation tabs to block list/show pages (PR #4644)

Anton Khorev notifications at github.com
Wed Apr 3 10:31:43 UTC 2024


![image](https://github.com/openstreetmap/openstreetmap-website/assets/4158490/2f8b1a53-4001-4bc6-9892-b86ada177eb1)
![image](https://github.com/openstreetmap/openstreetmap-website/assets/4158490/91f1f73f-77d5-4761-87ad-ed2006ba2cdb)

There's a potential problem though. Checks if a user has created any blocks are going to be made more often with this navigation, but there's no `creator_id` index on the blocks table. The options are:
- Do nothing because blocks pages are not the most visited and the blocks table is not the most populated.
- Remove `.blocks_created.exists?` checks. That would show more unnecessary and unexpected tabs: blocks by regular users but they can't make any blocks.
- Check if a user can create blocks instead of checking if they have created any. That would remove tabs for blocks by former moderators.
- Add a `creator_id` index on the blocks table.
- Add a `(creator_id, id)` index on the blocks table that will also help with sorting.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Add "All Blocks" nav tab to block list/show pages
  * Add "Blocks on Me" nav tab to block list/show pages
  * Add "Blocks by Me" nav tab to block list/show pages
  * Add "Blocks on user" nav tab to block list/show pages
  * Add "Blocks by user" nav tab to block list/show pages

-- File Changes --

    A app/views/user_blocks/_navigation.html.erb (37)
    M app/views/user_blocks/blocks_by.html.erb (3)
    M app/views/user_blocks/blocks_on.html.erb (3)
    M app/views/user_blocks/index.html.erb (3)
    M app/views/user_blocks/show.html.erb (7)
    M config/locales/en.yml (7)

-- Patch Links --

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

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

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


More information about the rails-dev mailing list