From d129f21547d8cf7b7d8e73734471d1f0ef34bd2e Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Mon, 16 Mar 2015 13:00:26 +0200 Subject: client/model/diff/Topo_Diff: ensure correct link names --- src/client/model/diff.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/client/model') diff --git a/src/client/model/diff.js b/src/client/model/diff.js index 36f62ddb..d6f0ed88 100644 --- a/src/client/model/diff.js +++ b/src/client/model/diff.js @@ -35,8 +35,21 @@ define(['consts'], this.node_id_set_rm = obj_spec.node_id_set_rm; this.node_set_add = obj_spec.node_set_add; this.link_set_add = obj_spec.link_set_add; + this._link_set_add__fix_empty_links(); } + + Topo_Diff.prototype._link_set_add__fix_empty_links = function() { + + function set_empty_link(link) { + if (link.name === '') { + link.name = consts.EMPTY_LINK_NAME; + } + } + this.link_set_add.forEach(set_empty_link); + + } + Topo_Diff.prototype.for_each_node_add = function(callback, this_arg) { this.node_set_add.forEach(callback, this_arg); } @@ -47,6 +60,7 @@ define(['consts'], Topo_Diff.prototype.for_each_link_add = function(callback, this_arg) { this.link_set_add.forEach(callback, this_arg); + this._link_set_add__fix_empty_links(); } Topo_Diff.prototype.for_each_link_rm = function(callback, this_arg) { -- cgit v1.3.1