This is a replacement for 
https://github.com/openstreetmap/openstreetmap-website/pull/5853. That area of 
the code has changed enough that I think the original PR cannot be salvaged.

This PR adds a preference that allows users to hide the heatmap from their 
profiles, if they so choose. There was a question of whether this was 
necessary, privacy implications, LWG discussion, etc. As communicated to me, 
this is the decision:
- OSM have a legitimate interest to show the heatmap, so it's ok that users 
get it by default.
- The heatmap is not strictly necessary in order to use OSM, so users should 
have the ability to hide it.

At the moment this a WIP in order to gather feedback, as I'm not sure about 
what is a good way to implement this. Notes:
- The option appears as a checkbox under the heatmap. At the moment, any 
preferences that affect the profile can be reached from the profile page, so 
filing this under Preferences didn't feel right.
<img width="550" height="282" alt="A checkbox 
labelled 'Show the heatmap on your profile page', showing under the 
user's contribution heatmap, next to a 'Save' button" 
src="https://github.com/user-attachments/assets/eab78cab-a72e-438c-a049-aa96efe118b8"
 />

- Storing the preference as a `UserPreference`.
- Since user preferences as stored as strings, there's a bit of mucking 
about with transforming strings into booleans, and back into strings. I use 
`ActiveModel::Type::Boolean.new.cast` and `ActiveModel::Type::String.new.cast` 
for this.
- Admins can see the heatmap even if the user is hiding it. They will see a 
message "This user has chosen to hide their heatmap from public view" 
so that there's no confusion.
- No tests yet.

Thoughts?
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * First stab at hiding the heatmap

-- File Changes --

    A app/controllers/profiles/heatmaps_controller.rb (23)
    M app/controllers/users/heatmaps_controller.rb (2)
    M app/controllers/users_controller.rb (2)
    M app/models/user.rb (12)
    M app/views/users/show.html.erb (12)
    M config/routes.rb (1)

-- Patch Links --

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

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

Message ID: <openstreetmap/openstreetmap-website/pull/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to