mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-23 22:23:51 +00:00
This was causing it to not immediately flag "area with no tags" as an error. (until the user edited the area some other way)
42 lines
1.5 KiB
JavaScript
42 lines
1.5 KiB
JavaScript
import { t } from '../util/locale';
|
|
import { utilDisplayLabel } from '../util';
|
|
import { validationIssue, validationIssueFix } from '../core/validator';
|
|
|
|
|
|
export function validationIncompatibleSource() {
|
|
var type = 'incompatible_source';
|
|
var invalidSources = [{id:'google', regex:'google'}];
|
|
|
|
var validation = function checkIncompatibleSource(entity, context) {
|
|
var issues = [];
|
|
|
|
if (entity.tags && entity.tags.source) {
|
|
invalidSources.forEach(function(invalidSource) {
|
|
var pattern = new RegExp(invalidSource.regex, 'i');
|
|
|
|
if (entity.tags.source.match(pattern)) {
|
|
issues.push(new validationIssue({
|
|
type: type,
|
|
severity: 'warning',
|
|
message: t('issues.incompatible_source.' + invalidSource.id + '.feature.message', {
|
|
feature: utilDisplayLabel(entity, context),
|
|
}),
|
|
tooltip: t('issues.incompatible_source.' + invalidSource.id + '.tip'),
|
|
entities: [entity],
|
|
fixes: [
|
|
new validationIssueFix({
|
|
title: t('issues.fix.remove_proprietary_data.title')
|
|
})
|
|
]
|
|
}));
|
|
}
|
|
});
|
|
}
|
|
return issues;
|
|
};
|
|
|
|
validation.type = type;
|
|
|
|
return validation;
|
|
}
|