mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 17:23:02 +00:00
Allow for multiple invalid sources
This commit is contained in:
@@ -6,25 +6,35 @@ import { validationIssue, validationIssueFix } from '../core/validator';
|
||||
export function validationIncompatibleSource() {
|
||||
var type = 'incompatible_source';
|
||||
|
||||
var validation = function(entity, context) {
|
||||
var invalidSources = [{id:"google", regex:"google"}];
|
||||
|
||||
if (entity.tags && entity.tags.source && entity.tags.source.toLowerCase().match(/google/)) {
|
||||
return [new validationIssue({
|
||||
type: type,
|
||||
severity: 'warning',
|
||||
message: t('issues.incompatible_source.google.feature.message', {
|
||||
feature: utilDisplayLabel(entity, context),
|
||||
}),
|
||||
tooltip: t('issues.incompatible_source.google.tip'),
|
||||
entities: [entity],
|
||||
fixes: [
|
||||
new validationIssueFix({
|
||||
title: t('issues.fix.remove_proprietary_data.title')
|
||||
})
|
||||
]
|
||||
})];
|
||||
var validation = function(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 [];
|
||||
return issues;
|
||||
};
|
||||
|
||||
validation.type = type;
|
||||
|
||||
Reference in New Issue
Block a user