diff --git a/node/src/client.js b/node/src/client.js index 7849224..0189914 100644 --- a/node/src/client.js +++ b/node/src/client.js @@ -155,10 +155,19 @@ class UserClient { }) 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", { chatId: chat.logId, - senderId: reader.userId, + senderId: senderId, channelId: channel.channelId, channelType: channel.info.type, })