Add missing null check for inbound read receipts
This commit is contained in:
parent
fbd3d514e3
commit
d4d02e8aba
|
@ -155,10 +155,19 @@ class UserClient {
|
||||||
})
|
})
|
||||||
|
|
||||||
this.#talkClient.on("chat_read", (chat, channel, reader) => {
|
this.#talkClient.on("chat_read", (chat, channel, reader) => {
|
||||||
this.log(`Chat ${chat.logId} read in channel ${channel.channelId} by ${reader.userId}`)
|
let senderId
|
||||||
|
if (reader) {
|
||||||
|
senderId = reader.userId
|
||||||
|
} else if (channel.info.type == "MemoChat") {
|
||||||
|
senderId = channel.clientUser.userId
|
||||||
|
} else {
|
||||||
|
this.error(`Chat ${chat.logId} read in channel ${channel.channelId} by unknown reader (channel type: ${channel.info.type || "none"})`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.log(`Chat ${chat.logId} read in channel ${channel.channelId} by ${senderId}`)
|
||||||
this.write("chat_read", {
|
this.write("chat_read", {
|
||||||
chatId: chat.logId,
|
chatId: chat.logId,
|
||||||
senderId: reader.userId,
|
senderId: senderId,
|
||||||
channelId: channel.channelId,
|
channelId: channel.channelId,
|
||||||
channelType: channel.info.type,
|
channelType: channel.info.type,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue