1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-09-01 21:21:58 +03:00

Merge pull request #35 from matrix-org/event_read_up_to

Add event to get last read receipt for a user.
This commit is contained in:
David Baker
2015-11-02 16:04:16 +00:00

View File

@@ -321,6 +321,24 @@ Room.prototype.getUsersReadUpTo = function(event) {
}); });
}; };
/**
* Get the ID of the event that a given user has read up to, or null if we
* have received no read receipts from them.
* @param {String} userId The user ID to get read receipt event ID for
* @return {String} ID of the latest event that the given user has read, or null.
* an empty list.
*/
Room.prototype.getEventReadUpTo = function(userId) {
if (
this._receipts["m.read"] === undefined ||
this._receipts["m.read"][userId] === undefined
) {
return null;
}
return this._receipts["m.read"][userId].eventId;
};
/** /**
* Get a list of receipts for the given event. * Get a list of receipts for the given event.
* @param {MatrixEvent} event the event to get receipts for * @param {MatrixEvent} event the event to get receipts for