openstreetmap / openstreetmap-website

The Rails application that powers OpenStreetMap
https://www.openstreetmap.org/
GNU General Public License v2.0
2.22k stars 918 forks source link

Add profile location #5302

Open nertc opened 2 weeks ago

nertc commented 2 weeks ago

PR adds location name info on the user profile page. Location name can be changed from "Edit Profile" page either by manual typing or auto-filling according to the home location.

One column was added to the user table to save user's location. JS logics are responsible for handling: 1) Delete-Undelete buttons interactions 2) Nominatim calls to locate home locations country name 3) Warning logic of the location name

image image image

tomhughes commented 2 weeks ago

This seems like an awful lot of complication...

It seems to me that we have the option of either allowing the user to input freetext, or of generating something from the location with Nominatim but this tries to do both at once which just makes things very complicated and probably quite confusing.

How often does nomination actually manage to match? I don't see any indication of zoom on the reverse geocode, and you're just taking the last name, so how likely is it that will match what the user entered even if they are trying to be accurate? Are we just going to wind up telling everybody their location doesn't match?

nertc commented 2 weeks ago

@tomhughes Thank you for the comment. I agree with you about the complexity of the code, but there are several reasons for both methods.

Changing location name manually solves cases like:

  1. Disputed areas - someone living in the area A may not want to show that area is part of country B and not C.
  2. Several countries - someone who has citizenship of several countries may want to set his location name to something like "Georgia & Germany"
  3. Choosing privacy - someone may want to explicitly mention "Tbilisi, Georgia", but someone may want to just show the country and keep other details private

Meanwhile, changing location with Nominatim autofill introduces:

  1. Better UX - if user is okay with showing only home country, autofill avoids extra typing from user
  2. Standardization - default value introduces default standard for user to easily perceive what kind of and what detalization of information is recommended for the field
  3. Motivation to fill - when user sees a warning about the field that it doesn't match home location, it subconsciously motivates him to click the autofill button (just one easy click) and increases use of the feature

By choosing only one solution we sacrifice either functionality or better UX.

Currently, autofill suggests name of the country and warning is only shown if manually typed location doesn't contain country name. Therefore, "Germany & Georgia", "Tbilisi, Georgia", "Georgia" won't show any autofill warning if user has home location set in Georgia.

nertc commented 10 hours ago

Thank you for the review. PR was updated according to the comments.