From 598827db87ef0e9f18c3bec57670333c216a0e40 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Wed, 20 Feb 2019 10:06:44 -0500 Subject: [PATCH] Add quick fix to remove deprecated tags --- data/core.yaml | 10 ++++++++-- dist/locales/en.json | 13 +++++++++++-- modules/validations/deprecated_tag.js | 17 +++++++++++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/data/core.yaml b/data/core.yaml index d8c31a5c7..b2011a69d 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -1267,12 +1267,18 @@ en: move_tags: title: Move the tags annotation: Moved tags. + remove_deprecated_tag: + annotation: Removed an old tag. + remove_deprecated_tag_combo: + annotation: Removed an old tag combination. remove_generic_name: title: Remove the name annotation: Removed a generic name. remove_tag: title: Remove the tag annotation: Removed tag. + remove_tags: + title: Remove the tags reposition_features: title: Reposition the features select_preset: @@ -1281,10 +1287,10 @@ en: title: Tag as disconnected annotation: Tagged very close features as disconnected. upgrade_tag: - title: Upgrade this tag + title: Upgrade the tag annotation: Upgraded an old tag. upgrade_tag_combo: - title: Upgrade these tags + title: Upgrade the tags annotation: Upgraded an old tag combination. use_bridge_or_tunnel: title: Use a bridge or tunnel diff --git a/dist/locales/en.json b/dist/locales/en.json index ffc435425..81d5ab577 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -1560,6 +1560,12 @@ "title": "Move the tags", "annotation": "Moved tags." }, + "remove_deprecated_tag": { + "annotation": "Removed an old tag." + }, + "remove_deprecated_tag_combo": { + "annotation": "Removed an old tag combination." + }, "remove_generic_name": { "title": "Remove the name", "annotation": "Removed a generic name." @@ -1568,6 +1574,9 @@ "title": "Remove the tag", "annotation": "Removed tag." }, + "remove_tags": { + "title": "Remove the tags" + }, "reposition_features": { "title": "Reposition the features" }, @@ -1579,11 +1588,11 @@ "annotation": "Tagged very close features as disconnected." }, "upgrade_tag": { - "title": "Upgrade this tag", + "title": "Upgrade the tag", "annotation": "Upgraded an old tag." }, "upgrade_tag_combo": { - "title": "Upgrade these tags", + "title": "Upgrade the tags", "annotation": "Upgraded an old tag combination." }, "use_bridge_or_tunnel": { diff --git a/modules/validations/deprecated_tag.js b/modules/validations/deprecated_tag.js index 818cd0b4a..e72677814 100644 --- a/modules/validations/deprecated_tag.js +++ b/modules/validations/deprecated_tag.js @@ -82,6 +82,23 @@ export function validationDeprecatedTag() { t('issues.fix.' + fixTextID + '.annotation') ); } + }), + new validationIssueFix({ + icon: 'iD-operation-delete', + title: t('issues.fix.' + (isCombo ? 'remove_tags' : 'remove_tag') + '.title'), + onClick: function() { + var entity = this.issue.entities[0]; + var tags = _clone(entity.tags); + var oldTags = this.issue.info.oldTags; + for (var key in oldTags) { + delete tags[key]; + } + var fixTextID = Object.keys(oldTags).length > 1 ? 'remove_deprecated_tag_combo' : 'remove_deprecated_tag'; + context.perform( + actionChangeTags(entity.id, tags), + t('issues.fix.' + fixTextID + '.annotation') + ); + } }) ] }));