1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-23 22:42:10 +03:00

Add event to get last read receipt for a user.

This commit is contained in:
David Baker
2015-11-02 14:39:10 +00:00
parent 83c53f6a79
commit c4a35020f1

View File

@@ -321,6 +321,21 @@ 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} 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 === undefined || this._receipts['m.read'] === undefined) {
return null;
}
return this._receipts['m.read'][userId].eventId;
};
/**
* Get a list of receipts for the given event.
* @param {MatrixEvent} event the event to get receipts for