Ignore client_updated_at when checking for equality
This commit is contained in:
@@ -256,6 +256,11 @@ class Item {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Same as above, but keys inside appData[AppDomain]
|
||||||
|
appDataKeysToIgnoreWhenCheckingContentEquality() {
|
||||||
|
return ["client_updated_at"];
|
||||||
|
}
|
||||||
|
|
||||||
isItemContentEqualWith(otherItem) {
|
isItemContentEqualWith(otherItem) {
|
||||||
let omit = (obj, keys) => {
|
let omit = (obj, keys) => {
|
||||||
for(var key of keys) {
|
for(var key of keys) {
|
||||||
@@ -263,8 +268,14 @@ class Item {
|
|||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
var left = omit(this.structureParams(), this.keysToIgnoreWhenCheckingContentEquality());
|
|
||||||
var right = omit(otherItem.structureParams(), otherItem.keysToIgnoreWhenCheckingContentEquality());
|
var left = this.structureParams();
|
||||||
|
left.appData[AppDomain] = omit(left.appData[AppDomain], this.appDataKeysToIgnoreWhenCheckingContentEquality());
|
||||||
|
left = omit(left, this.keysToIgnoreWhenCheckingContentEquality());
|
||||||
|
|
||||||
|
var right = otherItem.structureParams();
|
||||||
|
right.appData[AppDomain] = omit(right.appData[AppDomain], otherItem.appDataKeysToIgnoreWhenCheckingContentEquality());
|
||||||
|
right = omit(right, otherItem.keysToIgnoreWhenCheckingContentEquality());
|
||||||
|
|
||||||
return JSON.stringify(left) === JSON.stringify(right)
|
return JSON.stringify(left) === JSON.stringify(right)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user