mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-19 23:14:47 +02:00
Dedupe relations with same calculated name so d3.combobox will show them
(closes #2891)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user