mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-05 22:46:38 +02:00
Added entity display name or preset name to the disconnected highway message
This commit is contained in:
@@ -282,7 +282,7 @@ export function coreHistory(context) {
|
||||
|
||||
validate: function(changes) {
|
||||
return _flatten(_map(Validations, function(fn) {
|
||||
return fn()(changes, _stack[_index].graph);
|
||||
return fn(context)(changes, _stack[_index].graph);
|
||||
}));
|
||||
},
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { t } from '../util/locale';
|
||||
import { utilDisplayName } from '../util';
|
||||
|
||||
|
||||
export function validationDisconnectedHighway() {
|
||||
export function validationDisconnectedHighway(context) {
|
||||
|
||||
function isDisconnectedHighway(entity, graph) {
|
||||
if (!entity.tags.highway) return false;
|
||||
@@ -28,9 +29,18 @@ export function validationDisconnectedHighway() {
|
||||
var entity = changes.created[i];
|
||||
|
||||
if (isDisconnectedHighway(entity, graph)) {
|
||||
var entityLabel = utilDisplayName(entity);
|
||||
if (!entityLabel) {
|
||||
var preset = context.presets().match(entity, graph);
|
||||
if (preset && preset.name()) {
|
||||
entityLabel = preset.name();
|
||||
} else {
|
||||
entityLabel = utilDisplayType(entity.id)
|
||||
}
|
||||
}
|
||||
warnings.push({
|
||||
id: 'disconnected_highway',
|
||||
message: t('validations.disconnected_highway'),
|
||||
message: t('validations.disconnected_highway', {entityLabel: entityLabel}),
|
||||
tooltip: t('validations.disconnected_highway_tooltip'),
|
||||
entity: entity
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user