diff --git a/modules/osm/entity.js b/modules/osm/entity.js index 406673332..7212443de 100644 --- a/modules/osm/entity.js +++ b/modules/osm/entity.js @@ -176,10 +176,6 @@ osmEntity.prototype = { return Object.keys(this.tags).some(osmIsInterestingTag); }, - hasWikidata: function() { - return !!this.tags.wikidata || !!this.tags['brand:wikidata']; - }, - isHighwayIntersection: function() { return false; }, diff --git a/modules/validations/suspicious_name.js b/modules/validations/suspicious_name.js index 75baf119b..435bca2af 100644 --- a/modules/validations/suspicious_name.js +++ b/modules/validations/suspicious_name.js @@ -148,18 +148,21 @@ export function validationSuspiciousName() { let validation = function checkGenericName(entity) { - // a generic name is okay if it's a known brand or entity - if (entity.hasWikidata()) return []; + const tags = entity.tags; + + // a generic name is allowed if it's a known brand or entity + const hasWikidata = (!!tags.wikidata || !!tags['brand:wikidata'] || !!tags['operator:wikidata']); + if (hasWikidata) return []; let issues = []; - const notNames = (entity.tags['not:name'] || '').split(';'); + const notNames = (tags['not:name'] || '').split(';'); - for (let key in entity.tags) { + for (let key in tags) { const m = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/); if (!m) continue; const langCode = m.length >= 2 ? m[1] : null; - const value = entity.tags[key]; + const value = tags[key]; if (notNames.length) { for (let i in notNames) { const notName = notNames[i]; @@ -169,7 +172,7 @@ export function validationSuspiciousName() { } } } - if (isGenericName(value, entity.tags)) { + if (isGenericName(value, tags)) { issues.provisional = _waitingForGenerics; // retry later if we don't have the generics yet issues.push(makeGenericNameIssue(entity.id, key, value, langCode)); } diff --git a/test/spec/osm/entity.js b/test/spec/osm/entity.js index 9fff8c076..cbc81833d 100644 --- a/test/spec/osm/entity.js +++ b/test/spec/osm/entity.js @@ -275,20 +275,6 @@ describe('iD.osmEntity', function () { }); }); - describe('#hasWikidata', function () { - it('returns false if entity has no tags', function () { - expect(iD.osmEntity().hasWikidata()).to.be.not.ok; - }); - - it('returns true if entity has a wikidata tag', function () { - expect(iD.osmEntity({ tags: { wikidata: 'Q18275868' } }).hasWikidata()).to.be.ok; - }); - - it('returns true if entity has a brand:wikidata tag', function () { - expect(iD.osmEntity({ tags: { 'brand:wikidata': 'Q18275868' } }).hasWikidata()).to.be.ok; - }); - }); - describe('#hasInterestingTags', function () { it('returns false if the entity has no tags', function () { expect(iD.osmEntity().hasInterestingTags()).to.equal(false);