mirror of
https://github.com/Skylar-Tech/node-red-contrib-matrix-chat.git
synced 2026-05-23 23:53:26 -06:00
- Fix Mark Read node not working properly and update the docs for this node #111
This commit is contained in:
+11
-1
@@ -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}`;
|
||||
|
||||
Reference in New Issue
Block a user