From 538829d17134a96ca91aa04fa94a2f76589c14c3 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Thu, 7 Nov 2019 19:08:50 +0100 Subject: [PATCH] Don't flag nonstandard brands from incompatible countries (close #6513) --- modules/validations/outdated_tags.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/validations/outdated_tags.js b/modules/validations/outdated_tags.js index 000484e93..d5a89440f 100644 --- a/modules/validations/outdated_tags.js +++ b/modules/validations/outdated_tags.js @@ -1,5 +1,6 @@ import { t } from '../util/locale'; import { matcher, brands } from 'name-suggestion-index'; +import * as countryCoder from 'country-coder'; import { actionChangePreset } from '../actions/change_preset'; import { actionChangeTags } from '../actions/change_tags'; @@ -93,7 +94,9 @@ export function validationOutdatedTags(context) { var k = nsiKeys[i]; if (!newTags[k]) continue; - var match = nsiMatcher.matchKVN(k, newTags[k], newTags.name); + var center = entity.extent(graph).center(); + var countryCode = countryCoder.iso1A2Code(center); + var match = nsiMatcher.matchKVN(k, newTags[k], newTags.name, countryCode && countryCode.toLowerCase()); if (!match) continue; // for now skip ambiguous matches (like Target~(USA) vs Target~(Australia))