From a77b9d9027539587695fb0d0e3fbd6bdcf722608 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Thu, 13 Jan 2022 20:03:44 +0530 Subject: [PATCH] Move update logic to BaseMessageTile --- .../session/room/timeline/tiles/BaseMessageTile.js | 11 +++++++++++ src/domain/session/room/timeline/tiles/SimpleTile.js | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/domain/session/room/timeline/tiles/BaseMessageTile.js b/src/domain/session/room/timeline/tiles/BaseMessageTile.js index 174cdd0a..a594c722 100644 --- a/src/domain/session/room/timeline/tiles/BaseMessageTile.js +++ b/src/domain/session/room/timeline/tiles/BaseMessageTile.js @@ -116,6 +116,17 @@ export class BaseMessageTile extends SimpleTile { } updateEntry(entry, param) { + const replyEntry = entry.contextEntry; + if (replyEntry) { + // this is an update to contextEntry used for replyPreview + const action = this._replyTile?.updateEntry(replyEntry); + if (action?.shouldReplace) { + this._replyTile = this._tileCreator(replyEntry); + } + else { + this._replyTile?.emitChange(); + } + } const action = super.updateEntry(entry, param); if (action.shouldUpdate) { this._updateReactions(); diff --git a/src/domain/session/room/timeline/tiles/SimpleTile.js b/src/domain/session/room/timeline/tiles/SimpleTile.js index 54740d59..bed79012 100644 --- a/src/domain/session/room/timeline/tiles/SimpleTile.js +++ b/src/domain/session/room/timeline/tiles/SimpleTile.js @@ -94,17 +94,6 @@ export class SimpleTile extends ViewModel { // update received for already included (falls within sort keys) entry updateEntry(entry, param) { - const replyEntry = entry.contextEntry; - if (replyEntry) { - // this is an update to contextEntry used for replyPreview - const action = this._replyTile?.updateEntry(replyEntry); - if (action?.shouldReplace) { - this._replyTile = this._tileCreator(replyEntry); - } - else { - this._replyTile?.emitChange(); - } - } const renderedAsRedacted = this.shape === "redacted"; if (!entry.isGap && entry.isRedacted !== renderedAsRedacted) { // recreate the tile if the entry becomes redacted