- Fix Mark Read node not working properly and update the docs for this node #111

This commit is contained in:
2024-09-18 09:32:19 -06:00
parent 02826e2769
commit 9e3b66f4aa
2 changed files with 37 additions and 183 deletions
+11 -1
View File
@@ -56,7 +56,17 @@ module.exports = function(RED) {
let roomId = getToValue(msg, node.roomType, node.roomValue),
eventId = getToValue(msg, node.eventIdType, node.eventIdValue);
msg.payload = await node.server.matrixClient.setRoomReadMarkers(roomId, eventId);
const room = node.server.matrixClient.getRoom(roomId);
if (!room) {
throw new Error(`Room ${roomId} not found.`);
}
const event = room.findEventById(eventId);
if (!event) {
throw new Error(`Event ${eventId} not found in room ${roomId}.`);
}
await node.server.matrixClient.sendReceipt(event, "m.read")
node.send([msg, null]);
} catch(e) {
msg.error = `Room pagination error: ${e}`;