From 2eff493d379c209ecb3e36c916ed6d8a0f9a18bf Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Mon, 10 Jun 2019 11:39:42 -0400 Subject: [PATCH] Add outdated tags validation issue subtype for noncanonical brands Add specific warning message for noncanonical brands (close #6443) Don't allow autofixing noncanonical brand issues --- data/core.yaml | 3 +++ dist/locales/en.json | 4 ++++ modules/validations/outdated_tags.js | 13 +++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/data/core.yaml b/data/core.yaml index 51cf6e23e..b3c0a3a1e 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -1444,6 +1444,9 @@ en: incomplete: message: "{feature} has incomplete tags" reference: "Some features should have additional tags." + noncanonical_brand: + message: "{feature} looks like a brand with nonstandard tags" + reference: "All features of the same brand should be tagged the same way." private_data: title: Private Information tip: "Find features that may contain private information" diff --git a/dist/locales/en.json b/dist/locales/en.json index 84012271b..1437e54c3 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -1788,6 +1788,10 @@ "incomplete": { "message": "{feature} has incomplete tags", "reference": "Some features should have additional tags." + }, + "noncanonical_brand": { + "message": "{feature} looks like a brand with nonstandard tags", + "reference": "All features of the same brand should be tagged the same way." } }, "private_data": { diff --git a/modules/validations/outdated_tags.js b/modules/validations/outdated_tags.js index ef0a2ea4e..696ebf2ad 100644 --- a/modules/validations/outdated_tags.js +++ b/modules/validations/outdated_tags.js @@ -101,6 +101,7 @@ export function validationOutdatedTags(context) { var brand = brands.brands[match.kvnd]; if (brand && brand.tags['brand:wikidata']) { + subtype = 'noncanonical_brand'; Object.assign(newTags, brand.tags); break; } @@ -112,7 +113,15 @@ export function validationOutdatedTags(context) { var tagDiff = utilTagDiff(oldTags, newTags); if (!tagDiff.length) return []; - var prefix = subtype === 'incomplete_tags' ? 'incomplete.' : ''; + var prefix = ''; + if (subtype === 'noncanonical_brand') { + prefix = 'noncanonical_brand.'; + } else if (subtype === 'incomplete_tags') { + prefix = 'incomplete.'; + } + + // don't allow autofixing brand tags + var autoArgs = subtype !== 'noncanonical_brand' ? [doUpgrade, t('issues.fix.upgrade_tags.annotation')] : null; return [new validationIssue({ type: type, @@ -124,7 +133,7 @@ export function validationOutdatedTags(context) { hash: JSON.stringify(tagDiff), fixes: [ new validationIssueFix({ - autoArgs: [doUpgrade, t('issues.fix.upgrade_tags.annotation')], + autoArgs: autoArgs, title: t('issues.fix.upgrade_tags.title'), onClick: function(context) { context.perform(doUpgrade, t('issues.fix.upgrade_tags.annotation'));