How to use the m.read function in m

To help you get started, we’ve selected a few m examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla / releases-comm-central / chat / protocols / matrix / lib / matrix-sdk / sync-accumulator.js View on Github external
Object.keys(e.content[eventId]["m.read"]).forEach(userId => {
                        // clobber on user ID
                        currentData._readReceipts[userId] = {
                            data: e.content[eventId]["m.read"][userId],
                            eventId: eventId
                        };
                    });
                });
github matrix-org / matrix-js-sdk / src / sync-accumulator.js View on Github external
Object.keys(e.content).forEach((eventId) => {
                    if (!e.content[eventId]["m.read"]) {
                        return;
                    }
                    Object.keys(e.content[eventId]["m.read"]).forEach((userId) => {
                        // clobber on user ID
                        currentData._readReceipts[userId] = {
                            data: e.content[eventId]["m.read"][userId],
                            eventId: eventId,
                        };
                    });
                });
            });
github matrix-org / matrix-js-sdk / src / sync-accumulator.js View on Github external
Object.keys(e.content).forEach((eventId) => {
                    if (!e.content[eventId]["m.read"]) {
                        return;
                    }
                    Object.keys(e.content[eventId]["m.read"]).forEach((userId) => {
                        // clobber on user ID
                        currentData._readReceipts[userId] = {
                            data: e.content[eventId]["m.read"][userId],
                            eventId: eventId,
                        };
                    });
                });
            });
github matrix-hacks / matrix-puppet-server / src / puppet.ts View on Github external
this.client.on("Room.receipt", (event, room) => {
        if (this.adapter && this.adapter.sendReadReceipt) {
          if (room.roomId in this.thirdPartyRooms) {
            let content = event.getContent();
            for (var eventId in content) {
              for (var userId in content[eventId]['m.read']) {
                if (userId === this.userId) {
                  console.log("Receive a read event from ourself");
                  return this.adapter.sendReadReceipt(this.thirdPartyRooms[room.roomId]);
                }
              }
            }
          }
        }
      });
github matrix-construct / construct / share / webapp / js / room / receipt.js View on Github external
room.receipt.update.event = function(event, read)
{
	Object.update(event,
	{
		"m.read": read["m.read"],
	});
};
github matrix-org / matrix-js-sdk / src / models / room.js View on Github external
Room.prototype.getEventReadUpTo = function(userId, ignoreSynthesized) {
    let receipts = this._receipts;
    if (ignoreSynthesized) {
        receipts = this._realReceipts;
    }

    if (
        receipts["m.read"] === undefined ||
        receipts["m.read"][userId] === undefined
    ) {
        return null;
    }

    return receipts["m.read"][userId].eventId;
};
github mozilla / releases-comm-central / chat / protocols / matrix / lib / matrix-sdk / models / room.js View on Github external
Room.prototype.getEventReadUpTo = function (userId, ignoreSynthesized) {
    let receipts = this._receipts;
    if (ignoreSynthesized) {
        receipts = this._realReceipts;
    }

    if (receipts["m.read"] === undefined || receipts["m.read"][userId] === undefined) {
        return null;
    }

    return receipts["m.read"][userId].eventId;
};
github matrix-org / matrix-js-sdk / src / models / room.js View on Github external
Room.prototype.getEventReadUpTo = function(userId, ignoreSynthesized) {
    let receipts = this._receipts;
    if (ignoreSynthesized) {
        receipts = this._realReceipts;
    }

    if (
        receipts["m.read"] === undefined ||
        receipts["m.read"][userId] === undefined
    ) {
        return null;
    }

    return receipts["m.read"][userId].eventId;
};
github matrix-org / matrix-js-sdk / src / models / room.js View on Github external
Room.prototype.getEventReadUpTo = function(userId, ignoreSynthesized) {
    let receipts = this._receipts;
    if (ignoreSynthesized) {
        receipts = this._realReceipts;
    }

    if (
        receipts["m.read"] === undefined ||
        receipts["m.read"][userId] === undefined
    ) {
        return null;
    }

    return receipts["m.read"][userId].eventId;
};
github lukebarnard1 / journal / src / logic / main.js View on Github external
allEntries.forEach((e) => {
            const eventReceipts = currentRoom.receipts[e.id]
            if (!eventReceipts) return;
            const readReceipts = eventReceipts['m.read'];
            if (!readReceipts) return;

            seenByAcc += Object.keys(eventReceipts).length;
            e.seenByAcc = seenByAcc;
        });