From 7da37384f1a1d4825422ee8b73b0aeffff239b7a Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Thu, 21 Feb 2019 09:48:46 -0500 Subject: [PATCH] Fix an issue where stale missing tag errors could persist when canceling drawing a new way (close #5918) Don't show missing tags error for a feature that is still being drawn (re: #5898) --- modules/behavior/draw_way.js | 3 +++ modules/modes/draw_area.js | 9 +++++---- modules/modes/draw_line.js | 2 ++ modules/validations/missing_tag.js | 8 ++++++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/modules/behavior/draw_way.js b/modules/behavior/draw_way.js index c93b5f1a1..aed7a8042 100644 --- a/modules/behavior/draw_way.js +++ b/modules/behavior/draw_way.js @@ -329,6 +329,9 @@ export function behaviorDrawWay(context, wayID, index, mode, startGraph, baselin }, 1000); var isNewFeature = !mode.isContinuing; context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature)); + if (isNewFeature) { + context.validator().validate(); + } }; diff --git a/modules/modes/draw_area.js b/modules/modes/draw_area.js index 00ef60d50..c365be4a8 100644 --- a/modules/modes/draw_area.js +++ b/modules/modes/draw_area.js @@ -2,7 +2,7 @@ import { t } from '../util/locale'; import { behaviorDrawWay } from '../behavior'; -export function modeDrawArea(context, wayId, startGraph, baselineGraph) { +export function modeDrawArea(context, wayID, startGraph, baselineGraph) { var mode = { button: 'area', id: 'draw-area' @@ -10,11 +10,12 @@ export function modeDrawArea(context, wayId, startGraph, baselineGraph) { var behavior; + mode.wayID = wayID; mode.enter = function() { - var way = context.entity(wayId); + var way = context.entity(wayID); - behavior = behaviorDrawWay(context, wayId, undefined, mode, startGraph, baselineGraph) + behavior = behaviorDrawWay(context, wayID, undefined, mode, startGraph, baselineGraph) .tail(t('modes.draw_area.tail')); var addNode = behavior.addNode; @@ -40,7 +41,7 @@ export function modeDrawArea(context, wayId, startGraph, baselineGraph) { mode.selectedIDs = function() { - return [wayId]; + return [wayID]; }; diff --git a/modules/modes/draw_line.js b/modules/modes/draw_line.js index ba6748e3e..f37910500 100644 --- a/modules/modes/draw_line.js +++ b/modules/modes/draw_line.js @@ -10,6 +10,8 @@ export function modeDrawLine(context, wayID, startGraph, baselineGraph, affix, c var behavior; + mode.wayID = wayID; + mode.isContinuing = continuing; mode.enter = function() { diff --git a/modules/validations/missing_tag.js b/modules/validations/missing_tag.js index e54f20e42..a3464a9e9 100644 --- a/modules/validations/missing_tag.js +++ b/modules/validations/missing_tag.js @@ -29,6 +29,14 @@ export function validationMissingTag() { return []; } + var mode = context.mode(); + if (entity.type === 'way' && mode && + (mode.id === 'draw-area' || (mode.id === 'draw-line' && !mode.isContinuing)) && + mode.wayID === entity.id) { + // don't flag missing tag issues if drawing a new way + return []; + } + var messageObj = {}; var missingTagType;