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
This commit is contained in:
Quincy Morgan
2019-06-10 11:39:42 -04:00
parent f402748706
commit 2eff493d37
3 changed files with 18 additions and 2 deletions

View File

@@ -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"

View File

@@ -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": {

View File

@@ -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'));