mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 23:44:47 +02:00
Fix change summary calculation after restoring
We can't rely on identity equality here due to how restoring works, and don't want to anyway -- the summary should ignore net-no-op tag changes. Fixes #1915.
This commit is contained in:
@@ -118,8 +118,8 @@ iD.Difference = function(base, head) {
|
||||
addEntity(change.base, base, 'deleted');
|
||||
|
||||
} else if (change.base && change.head) { // modified vertex
|
||||
var moved = change.base.loc !== change.head.loc,
|
||||
retagged = change.base.tags !== change.head.tags;
|
||||
var moved = !_.isEqual(change.base.loc, change.head.loc),
|
||||
retagged = !_.isEqual(change.base.tags, change.head.tags);
|
||||
|
||||
if (moved) {
|
||||
addParents(change.head);
|
||||
|
||||
@@ -265,6 +265,18 @@ describe("iD.Difference", function () {
|
||||
}]);
|
||||
});
|
||||
|
||||
it("does not report a vertex as modified when it is moved and has no-op tag changes", function() {
|
||||
var vertex = base.entity('b').update({tags: {}, loc: [1, 2]}),
|
||||
head = base.replace(vertex),
|
||||
diff = iD.Difference(base, head);
|
||||
|
||||
expect(diff.summary()).to.eql([{
|
||||
changeType: 'modified',
|
||||
entity: head.entity('-'),
|
||||
graph: head
|
||||
}]);
|
||||
});
|
||||
|
||||
it("reports a vertex as deleted when it had tags", function() {
|
||||
var vertex = base.entity('v'),
|
||||
head = base.remove(vertex),
|
||||
|
||||
Reference in New Issue
Block a user