mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Also include operator:wikidata as a wikidata tag
osmEntity#hasWikipedia was only used by the suspicious_name validator
This commit is contained in:
@@ -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;
|
||||
},
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user