1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Merge remote-tracking branch 'origin/develop' into rav/context

This commit is contained in:
Richard van der Hoff
2016-01-27 09:49:00 +00:00
2 changed files with 18 additions and 1 deletions

View File

@@ -1378,9 +1378,15 @@ MatrixClient.prototype.sendReceipt = function(event, receiptType, callback) {
$receiptType: receiptType,
$eventId: event.getId()
});
return this._http.authedRequestWithPrefix(
var promise = this._http.authedRequestWithPrefix(
callback, "POST", path, undefined, {}, httpApi.PREFIX_V2_ALPHA
);
var room = this.getRoom(event.getRoomId());
if (room) {
room._addLocalEchoReceipt(this.credentials.userId, event, receiptType);
}
return promise;
};
/**

View File

@@ -895,6 +895,17 @@ Room.prototype.addReceipt = function(event) {
this.emit("Room.receipt", event, this);
};
/**
* Add a temporary local-echo receipt to the room to reflect in the
* client the fact that we've sent one.
* @param {string} userId The user ID if the receipt sender
* @param {MatrixEvent} e The event that is to be acknowledged
* @param {string} receiptType The type of receipt
*/
Room.prototype._addLocalEchoReceipt = function(userId, e, receiptType) {
this.addReceipt(synthesizeReceipt(userId, e, receiptType));
};
/**
* Update the room-tag event for the room. The previous one is overwritten.
* @param {MatrixEvent} event the m.tag event