Dedupe relations with same calculated name so d3.combobox will show them

(closes #2891)
This commit is contained in:
Bryan Housel
2016-04-16 23:17:04 -04:00
parent 7930a0bb36
commit 4dd4ccb205
+13
View File
@@ -67,6 +67,19 @@ iD.ui.RawMembershipEditor = function(context) {
result.sort(function(a, b) {
return iD.Relation.creationOrder(a.relation, b.relation);
});
// Dedupe identical names by appending relation id - see #2891
var dupeGroups = _(result)
.groupBy('value')
.filter(function(v) { return v.length > 1; })
.value();
dupeGroups.forEach(function(group) {
group.forEach(function(obj) {
obj.value += ' ' + obj.relation.id;
});
});
result.unshift(newRelation);
return result;