From 38f833d19c7bae83fdce6841035786d7f46985d3 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Mon, 2 Mar 2015 22:47:13 -0500 Subject: [PATCH] Exclude current way when checking if childnode is used --- js/id/actions/merge_remote_changes.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/js/id/actions/merge_remote_changes.js b/js/id/actions/merge_remote_changes.js index cb9c7520c..14d1ef481 100644 --- a/js/id/actions/merge_remote_changes.js +++ b/js/id/actions/merge_remote_changes.js @@ -64,9 +64,10 @@ iD.actions.MergeRemoteChanges = function(id, localGraph, remoteGraph, formatUser function mergeChildren(target, children, updates, graph) { - function isUsed(node) { + function isUsed(node, target) { + var parentWays = _.pluck(graph.parentWays(node), 'id'); return node.hasInterestingTags() || - graph.parentWays(node).length > 0 || + _.without(parentWays, target.id).length > 0 || graph.parentRelations(node).length > 0; } @@ -76,9 +77,9 @@ iD.actions.MergeRemoteChanges = function(id, localGraph, remoteGraph, formatUser var id = children[i], node = graph.hasEntity(id); - // remove unused childNodes. + // remove unused childNodes.. if (target.nodes.indexOf(id) === -1) { - if (node && !isUsed(node)) { + if (node && !isUsed(node, target)) { updates.removeIds.push(id); } continue;