Fix error in startup emojis check
This commit is contained in:
parent
600ca1a11d
commit
7d4379a099
2 changed files with 8 additions and 2 deletions
|
@ -219,7 +219,13 @@ async function syncSpaceExpressions(data, checkBeforeSync) {
|
||||||
if (!(key in data) || !data[key].length) return
|
if (!(key in data) || !data[key].length) return
|
||||||
const content = await fn(data[key])
|
const content = await fn(data[key])
|
||||||
if (checkBeforeSync) {
|
if (checkBeforeSync) {
|
||||||
const existing = await api.getStateEvent(spaceID, "im.ponies.room_emotes", eventKey)
|
let existing
|
||||||
|
try {
|
||||||
|
existing = await api.getStateEvent(spaceID, "im.ponies.room_emotes", eventKey)
|
||||||
|
} catch (e) {
|
||||||
|
// State event not found. This space doesn't have any existing emojis. We create a dummy empty event for comparison's sake.
|
||||||
|
existing = fn([])
|
||||||
|
}
|
||||||
if (deepEqual(existing, content, {strict: true})) return
|
if (deepEqual(existing, content, {strict: true})) return
|
||||||
}
|
}
|
||||||
api.sendState(spaceID, "im.ponies.room_emotes", eventKey, content)
|
api.sendState(spaceID, "im.ponies.room_emotes", eventKey, content)
|
||||||
|
|
|
@ -39,7 +39,7 @@ async function mreq(method, url, body, extra = {}) {
|
||||||
const res = await fetch(baseUrl + url, opts)
|
const res = await fetch(baseUrl + url, opts)
|
||||||
const root = await res.json()
|
const root = await res.json()
|
||||||
|
|
||||||
if (!res.ok || root.errcode) throw new MatrixServerError(root, opts)
|
if (!res.ok || root.errcode) throw new MatrixServerError(root, {baseUrl, url, ...opts})
|
||||||
return root
|
return root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue