From 45b74d87308dc959622253ee48af80b7f9a8626a Mon Sep 17 00:00:00 2001 From: Benoit Costamagna Date: Mon, 29 Jan 2018 13:10:39 +0100 Subject: [PATCH] Added difference between ways and areas --- data/core.yaml | 2 +- dist/locales/en.json | 2 +- modules/validations/many_deletions.js | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/data/core.yaml b/data/core.yaml index f4f85751b..f4c278182 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -535,7 +535,7 @@ en: untagged_area_tooltip: "Select a feature type that describes what this area is." untagged_relation: Untagged relation untagged_relation_tooltip: "Select a feature type that describes what this relation is." - many_deletions: "You're deleting {n} features: {p} nodes, {l} lines, {r} relations. Are you sure you want to do this? This will delete them from the map that everyone else sees on openstreetmap.org." + many_deletions: "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: "The tag {tag} suggests line should be area, but it is not an area" deprecated_tags: "Deprecated tags: {tags}" zoom: diff --git a/dist/locales/en.json b/dist/locales/en.json index 8fd2c0abd..30b36a3ab 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -654,7 +654,7 @@ "untagged_area_tooltip": "Select a feature type that describes what this area is.", "untagged_relation": "Untagged relation", "untagged_relation_tooltip": "Select a feature type that describes what this relation is.", - "many_deletions": "You're deleting {n} features: {p} nodes, {l} lines, {r} relations. Are you sure you want to do this? This will delete them from the map that everyone else sees on openstreetmap.org.", + "many_deletions": "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": "The tag {tag} suggests line should be area, but it is not an area", "deprecated_tags": "Deprecated tags: {tags}" }, diff --git a/modules/validations/many_deletions.js b/modules/validations/many_deletions.js index a9ad79ba1..12c2689f4 100644 --- a/modules/validations/many_deletions.js +++ b/modules/validations/many_deletions.js @@ -4,20 +4,21 @@ import { t } from '../util/locale'; export function validationManyDeletions() { var threshold = 100; - var validation = function(changes) { + var validation = function(changes, graph) { var warnings = []; - var nodes=0, ways=0, relations=0; + var nodes=0, ways=0, areas=0, relations=0; changes.deleted.forEach(function(c) { if (c.type == 'node') {nodes++} - else if (c.type == 'way') {ways++} + else if (c.type == 'way' && c.geometry(graph) == 'line') {ways++} + else if (c.type == 'way' && c.geometry(graph) == 'area') {areas++} else if (c.type == 'relation') {relations++} }); if (changes.deleted.length > threshold) { warnings.push({ id: 'many_deletions', message: t('validations.many_deletions', - { n: changes.deleted.length, p: nodes, l: ways, r: relations }) + { n: changes.deleted.length, p: nodes, l: ways, a:areas, r: relations }) }); }