Improve message and add tooltip to tag_suggeset_area validation

This commit is contained in:
Quincy Morgan
2019-01-25 14:24:53 -05:00
parent cc9fae312e
commit 62ac471808
3 changed files with 10 additions and 7 deletions
+2 -1
View File
@@ -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.
+2 -1
View File
@@ -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}",
+6 -5
View File
@@ -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],
}));
}
}