drop *:wikipedia tags when selecting a NSI-based, fixes #9103

This commit is contained in:
Martin Raifer
2024-02-16 14:32:03 +01:00
parent 70a117a38c
commit 4829f8a1da
3 changed files with 20 additions and 0 deletions
+2
View File
@@ -58,8 +58,10 @@ _Breaking developer changes, which may affect downstream projects or sites that
#### :rocket: Presets
* Don't consider traffic_calming features as areas ([id-tagging-schema#1076])
* Add rendering style for roller coaster tracks and supports ([#9891], thanks [@mangerlahn])
* Drop `*:wikipedia` tags when switching to a new NSI-based preset which specifies a corresponding `*:wikidata` tag ([#9103])
#### :hammer: Development
[#9103]: https://github.com/openstreetmap/iD/issues/9103
[#9424]: https://github.com/openstreetmap/iD/pull/9424
[#9422]: https://github.com/openstreetmap/iD/issues/9422
[#9876]: https://github.com/openstreetmap/iD/issues/9876
+3
View File
@@ -248,6 +248,9 @@ export function presetPreset(presetID, preset, addable, allFields, allPresets) {
if (_this.tags[k] || !tags[k]) {
tags[k] = 'yes';
}
} else if (addTags[k] === '') {
// empty string equates to a tag which should be removed
delete tags[k];
} else {
tags[k] = addTags[k];
}
+15
View File
@@ -82,6 +82,21 @@ function loadNsiPresets() {
// The preset json schema doesn't include it, but the iD code still uses it
Object.values(vals[0].presets).forEach(preset => preset.suggestion = true);
// nsi does not specify *:wikipedia (anymore):
// clean up previous values to prevent that the wikidata/wikipedia information
// is going to be out of sync, see #9103
Object.values(vals[0].presets).forEach(preset => {
if (preset.tags['brand:wikidata']) {
preset.addTags['brand:wikipedia'] = '';
}
if (preset.tags['operator:wikidata']) {
preset.addTags['operator:wikipedia'] = '';
}
if (preset.tags['network:wikidata']) {
preset.addTags['network:wikipedia'] = '';
}
});
presetManager.merge({
presets: vals[0].presets,
featureCollection: vals[1]