Attempt to prevent users from uploading duplicate changes

(closes #5200)

This removes a users changes stored in localStorage if they try to close
iD while an upload is in progress.  It prevents the possiblity that the
changeset is eventually accepted and closed, but the user can be prompted
to restore those changes the next time they start iD.
This commit is contained in:
Bryan Housel
2018-08-11 19:15:18 -04:00
parent eab7f3660b
commit 930e865b42
2 changed files with 12 additions and 0 deletions
+7
View File
@@ -201,6 +201,13 @@ export function coreContext() {
var canSave;
if (mode && mode.id === 'save') {
canSave = false;
// Attempt to prevent user from creating duplicate changes - see #5200
if (services.osm && services.osm.isChangesetInflight()) {
history.clearSaved();
return;
}
} else {
canSave = context.selectedIDs().every(function(id) {
var entity = context.hasEntity(id);
+5
View File
@@ -985,6 +985,11 @@ export default {
},
isChangesetInflight: function() {
return !!_changeset.inflight;
},
// get/set cached data
// This is used to save/restore the state when entering/exiting the walkthrough
// Also used for testing purposes.