From 62ac4718081f6c879985ba7d29f59d80105cf664 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Fri, 25 Jan 2019 14:24:53 -0500 Subject: [PATCH] Improve message and add tooltip to tag_suggeset_area validation --- data/core.yaml | 3 ++- dist/locales/en.json | 3 ++- modules/validations/tag_suggests_area.js | 11 ++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/data/core.yaml b/data/core.yaml index b78f77db0..840c2cc82 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -1160,7 +1160,8 @@ en: many_deletions: message: "You're deleting {n} features: {p} nodes, {l} lines, {a} areas, {r} relations. Are you sure you want to do this? This will delete them from the map that everyone else sees on openstreetmap.org." tag_suggests_area: - message: "The tag {tag} suggests line should be area, but it is not an area." + message: 'Feature is a line, but the tag "{tag}" suggests it should be an area.' + tip: Areas must have connected endpoints. deprecated_tags: message: '{feature} has outdated tags: {tags}' tip: Some tags become deprecated over time and should be replaced. diff --git a/dist/locales/en.json b/dist/locales/en.json index 502c5e6d9..b2ad50344 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -1408,7 +1408,8 @@ "message": "You're deleting {n} features: {p} nodes, {l} lines, {a} areas, {r} relations. Are you sure you want to do this? This will delete them from the map that everyone else sees on openstreetmap.org." }, "tag_suggests_area": { - "message": "The tag {tag} suggests line should be area, but it is not an area." + "message": "Feature is a line, but the tag \"{tag}\" suggests it should be an area.", + "tip": "Areas must have connected endpoints." }, "deprecated_tags": { "message": "{feature} has outdated tags: {tags}", diff --git a/modules/validations/tag_suggests_area.js b/modules/validations/tag_suggests_area.js index 2496f28f8..0c83795db 100644 --- a/modules/validations/tag_suggests_area.js +++ b/modules/validations/tag_suggests_area.js @@ -9,7 +9,7 @@ import { // https://github.com/openstreetmap/josm/blob/mirror/src/org/ // openstreetmap/josm/data/validation/tests/UnclosedWays.java#L80 -export function validationTagSuggestsArea() { +export function validationTagSuggestsArea(context) { function tagSuggestsArea(tags) { if (_isEmpty(tags)) return false; @@ -32,16 +32,17 @@ export function validationTagSuggestsArea() { var validation = function(entitiesToCheck, graph) { var issues = []; for (var i = 0; i < entitiesToCheck.length; i++) { - var change = entitiesToCheck[i]; - var geometry = change.geometry(graph); - var suggestion = (geometry === 'line' ? tagSuggestsArea(change.tags) : undefined); + var entity = entitiesToCheck[i]; + var geometry = entity.geometry(graph); + var suggestion = (geometry === 'line' ? tagSuggestsArea(entity.tags) : undefined); if (suggestion) { issues.push(new validationIssue({ type: ValidationIssueType.tag_suggests_area, severity: ValidationIssueSeverity.warning, message: t('issues.tag_suggests_area.message', { tag: suggestion }), - entities: [change], + tooltip: t('issues.tag_suggests_area.tip'), + entities: [entity], })); } }