fix deletes causing errors

This commit is contained in:
Henry Jameson 2019-12-11 18:20:43 +02:00
parent 6acd889589
commit 63a5f50e7c
1 changed files with 4 additions and 0 deletions

View File

@ -1010,6 +1010,10 @@ export const handleMastoWS = (wsEvent) => {
const parsedEvent = JSON.parse(data) const parsedEvent = JSON.parse(data)
const { event, payload } = parsedEvent const { event, payload } = parsedEvent
if (MASTODON_STREAMING_EVENTS.has(event)) { if (MASTODON_STREAMING_EVENTS.has(event)) {
// MastoBE and PleromaBE both send payload for delete as a PLAIN string
if (event === 'delete') {
return { event, id: payload }
}
const data = payload ? JSON.parse(payload) : null const data = payload ? JSON.parse(payload) : null
if (event === 'update') { if (event === 'update') {
return { event, status: parseStatus(data) } return { event, status: parseStatus(data) }