You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Add local echo for read receipts. Fixes https://github.com/vector-im/vector-web/issues/623
This commit is contained in:
@@ -1369,9 +1369,15 @@ MatrixClient.prototype.sendReceipt = function(event, receiptType, callback) {
|
|||||||
$receiptType: receiptType,
|
$receiptType: receiptType,
|
||||||
$eventId: event.getId()
|
$eventId: event.getId()
|
||||||
});
|
});
|
||||||
return this._http.authedRequestWithPrefix(
|
var promise = this._http.authedRequestWithPrefix(
|
||||||
callback, "POST", path, undefined, {}, httpApi.PREFIX_V2_ALPHA
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -620,6 +620,17 @@ Room.prototype.addReceipt = function(event) {
|
|||||||
this.emit("Room.receipt", event, this);
|
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} user_id The user ID if the receipt sender
|
||||||
|
* @param {MatrixEvent} e The event that is to be acknowledged
|
||||||
|
* @param {string} receipt_type The type of receipt
|
||||||
|
*/
|
||||||
|
Room.prototype._addLocalEchoReceipt = function(user_id, e, receipt_type) {
|
||||||
|
this.addReceipt(synthesizeReceipt(user_id, e, receipt_type));
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the room-tag event for the room. The previous one is overwritten.
|
* Update the room-tag event for the room. The previous one is overwritten.
|
||||||
* @param {MatrixEvent} event the m.tag event
|
* @param {MatrixEvent} event the m.tag event
|
||||||
|
|||||||
Reference in New Issue
Block a user