-
Notifications
You must be signed in to change notification settings - Fork 918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add profile location #5302
base: master
Are you sure you want to change the base?
Add profile location #5302
Conversation
d20e90d
to
e5de628
Compare
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? |
@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:
Meanwhile, changing location with Nominatim autofill introduces:
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. |
user = create(:user) | ||
sign_in_as(user) | ||
|
||
visit user_path(user.display_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You write it differently below
visit user_path(user.display_name) | |
visit user_path(user) |
const geocodeUrl = `${OSM.NOMINATIM_URL}reverse?format=json&lat=${lat}&lon=${lon}`; | ||
|
||
if (locationInput.request) locationInput.request.abort(); | ||
locationInput.request = $.getJSON(geocodeUrl, function (data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blocked by content security policy
<div id="location_name_warning" class="row align-items-center d-none"> | ||
<p class="m-0 w-auto fs-6 pe-1"><%= t ".location_name_warning" %></p> | ||
<button id="location_default_name" class="btn btn-link p-0 w-auto text-sm-start" type="button"></button> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return; | ||
} | ||
|
||
const geocodeUrl = `${OSM.NOMINATIM_URL}reverse?format=json&lat=${lat}&lon=${lon}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you only want a country why don't you ask for a country
const geocodeUrl = `${OSM.NOMINATIM_URL}reverse?format=json&lat=${lat}&lon=${lon}`; | |
const geocodeUrl = `${OSM.NOMINATIM_URL}reverse?format=json&lat=${lat}&lon=${lon}&zoom=3`; |
instead of getting a full address of things you don't care about and then doing .split(",")
?
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: