Skip to content
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

Store preferences in OSM profile with fallback to localStorage #3002

Open
jancborchardt opened this issue Feb 26, 2016 · 22 comments
Open

Store preferences in OSM profile with fallback to localStorage #3002

jancborchardt opened this issue Feb 26, 2016 · 22 comments
Labels
iD v3 Ideas and issues for the next major iD version new-feature A new feature for iD

Comments

@jancborchardt
Copy link

Currently every time I want to edit on OSM.org, this modal asking me if I’m interested in a tutorial (or just want to start editing) pops up every time. Yes, the new editor is awesome and no, I don’t need a tutorial. ;) At some point in the past I’m pretty sure I did the tutorial and it probably helped me. But now the popup is annoying – every time.

TL;DR: Only show this popup once for a user. When I click »Edit« in the top bar, I want to directly edit. (I assume the tutorial can be accessed otherwise anyway if it’s needed later.)

As @tomhughes said in openstreetmap/openstreetmap-website#1162 (comment), the mechanism for remembering if to show the popup or not is briwser local storage. It would be more appropriate to permanently store it with the user profile because otherwise it will pop up again when switching browsers or devices, clearing profiles, reinstalling etc – everything which has nothing to do with the editor.

@bhousel
Copy link
Member

bhousel commented Feb 26, 2016

The store will definitely need to stay as the browser's localStorage. There is no capability to store editor preferences in the user's OSM profile.

Have you disabled localStorage, or are running in incognito mode?

@bhousel
Copy link
Member

bhousel commented Feb 26, 2016

BTW, I was wrong before and there actually is a way to store editor preferences with the user's OSM profile.
http://wiki.openstreetmap.org/wiki/API_v0.6#Preferences_of_the_logged-in_user

@DarkPrince304
Copy link

Hello @bhousel , @jancborchardt

I would like to work on a fix for this. Has anyone already started looking into this? Or has this been fixed?

What I plan to do is aunthenticate with the logged in user and send a PUT request with a key and a value which will enable the user to remember his/her choice.

I looked around the source code and came across these lines:

if (context.storage('sawSplash'))
             return;
context.storage('sawSplash', true);

which if I am correct means that the localStorage implementation has been done for the time being?

@bhousel
Copy link
Member

bhousel commented Mar 3, 2016

I'm not sure whether we want to do this. My initial feeling was to just close it as WONTFIX, but I decided to leave it open for discussion. Do we really want to store user preferences in OSM?

We do store a bunch of things in localStorage that could just as well be stored in OSM, but we'd need to add the necessary methods to iD.Connection to PUT/GET to these endpoints and serialize/deserialize the XML. It just seems like a lot of work for very little benefit.

For this to work the user needs to be already authenticated. This is the case when iD is embedded in OSM.org, but not necessarily when iD is used on other sites.

@pnorman
Copy link
Contributor

pnorman commented Mar 3, 2016

There's not much precedent for what to store in the user preferences. Anything that is stored should be valid across multiple computers and editor instances, which the iD walkthrough remembering is. If you've gone through the iD walkthrough on osm.org, you don't need to on another site.

@jfirebaugh
Copy link
Member

I'm in favor of storing preferences using the API. Maybe just store them all in one JSON blob?

@pnorman
Copy link
Contributor

pnorman commented Mar 3, 2016

Since it stores key=values, I think it makes more sense to store individual values for most items.

@bhousel
Copy link
Member

bhousel commented Mar 3, 2016

@jfirebaugh how about history too? I have been regularly pushing my edits up into the many hundreds and overflowing the localStorage limit.

@bhousel
Copy link
Member

bhousel commented Mar 3, 2016

Yes I'd also prefer separate key=values for flexibility in changing things.

@pnorman
Copy link
Contributor

pnorman commented Mar 3, 2016

History isn't a preference, and storing it on the server means that you'll loose if you can't upload, which is when you need it the most.

@DarkPrince304
Copy link

Hello,

Even I think storing on the API Side would be a nice idea. I would like to look into this. So would need some guidance on this. I guess this will require a new pair of key-value? So how do I add this pair to the user preference list?

By the way on this site : http://www.openstreetmap.org/edit?editor=id that popup is visible but it isnt visible on www.openstreetmap.org. Is that the expected behaviour?

@bhousel
Copy link
Member

bhousel commented Mar 3, 2016

@DarkPrince304 This is not a very good task for a new contributor, but if you really are interested my advice is to look in iD.Connection at how iD communicates with the OSM API.

There is an authenticated() method that would tell you if the user is already logged in.

Code in the global iD context object manages localStorage, so that is the place where you'd need to check whether the user is authenticated and call the (not yet written) code in iD.connection to pull values from server side storage. It would need to fall back to localStorage if the user is not authenticated, and ideally push local storage to server storage once authentication happens.

@bhousel bhousel changed the title Map editor popup (tutorial / start editing) pops up every time Store preferences in OSM profile with fallback to localStorage Mar 8, 2016
@bhousel bhousel added new-feature A new feature for iD and removed enhancement labels Nov 1, 2016
@tbertels
Copy link

tbertels commented Jul 8, 2017

@bhousel
Copy link
Member

bhousel commented Oct 31, 2017

This relates to #3239 / #4418 and would land as an iD v3 feature..

There are currently assumptions in the code that a user's settings are available synchronously at startup (e.g. to show the splash screen and restore history), and introducing an asynchronous dependency would be a breaking change.

@bhousel bhousel added the iD v3 Ideas and issues for the next major iD version label Mar 3, 2018
@jidanni
Copy link
Contributor

jidanni commented Dec 26, 2019

I was still able to trigger the "Welcome to the iD OpenStreetMap editor" by directly clicking "edit" from the osm.org homepage when not logged in.
I think the assumption is the user will first click "Log in", then after logging in, then click "Edit".
However if he instead first clicks "Edit", (then fills in his password,) he will trigger the "Welcome to the iD OpenStreetMap editor" pop-up (despite having used iD lots before.)

@tbertels
Copy link

@jidanni: I actually got it will being logged in and clicking on Edit, so I think it's because of the new privacy policy (#7040).

@jtracey
Copy link
Contributor

jtracey commented Jul 23, 2020

The preference to show third party icons, which the UI implies will be stored, is currently not. I'm assuming fixing that would be part of this bug?

@quincylvania
Copy link
Collaborator

@jtracey Third-party icons aren't intended to be stored between sessions. The privacy option is about whether to load them at all.

@jtracey
Copy link
Contributor

jtracey commented Jul 24, 2020

@quincylvania I know, I'm saying the setting to not do that isn't stored (i.e., I have to disable it every time I load iD).

@bhousel
Copy link
Member

bhousel commented Jul 24, 2020

I'm saying the setting to not do that isn't stored (i.e., I have to disable it every time I load iD).

The preference should be stored, unless you are using something like incognito mode, or maybe a privacy-focused web browser that throws out the storage.

@jtracey
Copy link
Contributor

jtracey commented Jul 24, 2020

I delete local storage when I close the browser, yes. Which is exactly what this issue is about ameliorating, no?

@bhousel
Copy link
Member

bhousel commented Jul 24, 2020

I delete local storage when I close the browser, yes. Which is exactly what this issue is about ameliorating, no?

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iD v3 Ideas and issues for the next major iD version new-feature A new feature for iD
Projects
None yet
Development

No branches or pull requests

9 participants