Don't add hide_ui when not present
This commit is contained in:
@@ -87,6 +87,12 @@ function diffKState(actual, target) {
|
||||
diff[key] = temp
|
||||
}
|
||||
|
||||
} else if (key === "chat.schildi.hide_ui/read_receipts") {
|
||||
// Special handling: don't add this key if it's new. Do overwrite if already present.
|
||||
if (key in actual) {
|
||||
diff[key] = target[key]
|
||||
}
|
||||
|
||||
} else if (key in actual) {
|
||||
// diff
|
||||
if (!isDeepStrictEqual(actual[key], target[key])) {
|
||||
|
@@ -234,3 +234,31 @@ test("diffKState: kstate keys must contain a slash separator", t => {
|
||||
, /does not contain a slash separator/)
|
||||
t.pass()
|
||||
})
|
||||
|
||||
test("diffKState: don't add hide_ui when not present", t => {
|
||||
test("diffKState: detects new properties", t => {
|
||||
t.deepEqual(
|
||||
diffKState({
|
||||
}, {
|
||||
"chat.schildi.hide_ui/read_receipts/": {}
|
||||
}),
|
||||
{
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
test("diffKState: overwriten hide_ui when present", t => {
|
||||
test("diffKState: detects new properties", t => {
|
||||
t.deepEqual(
|
||||
diffKState({
|
||||
"chat.schildi.hide_ui/read_receipts/": {hidden: true}
|
||||
}, {
|
||||
"chat.schildi.hide_ui/read_receipts/": {}
|
||||
}),
|
||||
{
|
||||
"chat.schildi.hide_ui/read_receipts/": {}
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user