diff --git a/data/core.yaml b/data/core.yaml index 1e25b11dc..2ba0f89d7 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -623,7 +623,7 @@ en: on_wiki: "{tag} on wiki.osm.org" used_with: "used with {type}" validations: - disconnected_highway: Disconnected highway + disconnected_highway: "{entityLabel} is disconnected from other highways." disconnected_highway_tooltip: "Roads should be connected to other roads or building entrances." old_multipolygon: Multipolygon tags on outer way old_multipolygon_tooltip: "This style of multipolygon is deprecated. Please assign the tags to the parent multipolygon instead of the outer way." diff --git a/dist/locales/en.json b/dist/locales/en.json index 4f27dd7a3..0a04218ef 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -760,7 +760,7 @@ "used_with": "used with {type}" }, "validations": { - "disconnected_highway": "Disconnected highway", + "disconnected_highway": "{entityLabel} is disconnected from other highways.", "disconnected_highway_tooltip": "Roads should be connected to other roads or building entrances.", "old_multipolygon": "Multipolygon tags on outer way", "old_multipolygon_tooltip": "This style of multipolygon is deprecated. Please assign the tags to the parent multipolygon instead of the outer way.", diff --git a/modules/core/history.js b/modules/core/history.js index db837d45c..2699b9200 100644 --- a/modules/core/history.js +++ b/modules/core/history.js @@ -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); })); }, diff --git a/modules/validations/disconnected_highway.js b/modules/validations/disconnected_highway.js index ef2d8cf8c..cc07dba85 100644 --- a/modules/validations/disconnected_highway.js +++ b/modules/validations/disconnected_highway.js @@ -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 });