1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-05 17:02:07 +03:00

add unstableClientRelationReplacements in js-sdk

This commit is contained in:
Bruno Windels
2019-05-14 15:33:49 +01:00
parent 455f52f1f5
commit 852c88c341
3 changed files with 14 additions and 1 deletions

View File

@@ -99,6 +99,11 @@ function synthesizeReceipt(userId, event, receiptType) {
* via `EventTimelineSet#getRelationsForEvent`.
* This feature is currently unstable and the API may change without notice.
*
* @param {boolean} [opts.unstableClientRelationReplacements = false]
* Optional. Set to true to enable client-side handling of m.replace event relations,
* exposed through the `Room.replaceEvent` event.
* This feature is currently unstable and the API may change without notice.
*
* @prop {string} roomId The ID of this room.
* @prop {string} name The human-readable display name for this room.
* @prop {Array<MatrixEvent>} timeline The live event timeline for this room,
@@ -1027,7 +1032,7 @@ Room.prototype._addLiveEvent = function(event, duplicateStrategy) {
// this may be needed to trigger an update.
}
if (event.isReplacement()) {
if (this._opts.unstableClientRelationReplacements && event.isReplacement()) {
const replacedEventId = event.getOriginalId();
const replacedEvent = replacedEventId &&
this.getUnfilteredTimelineSet().tryReplaceEvent(replacedEventId, event);