mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-22 00:07:03 +02:00
Merge branch 'master' into validation_and_change_perf
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
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(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;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ export { validationAlmostJunction } from './almost_junction';
|
||||
export { validationCrossingWays } from './crossing_ways';
|
||||
export { validationDisconnectedWay } from './disconnected_way';
|
||||
export { validationGenericName } from './generic_name';
|
||||
export { validationIncompatibleSource } from './incompatible_source';
|
||||
export { validationManyDeletions } from './many_deletions';
|
||||
export { validationMaprules } from './maprules';
|
||||
export { validationMissingRole } from './missing_role';
|
||||
|
||||
Reference in New Issue
Block a user