Move update logic to BaseMessageTile

This commit is contained in:
RMidhunSuresh 2022-01-13 20:03:44 +05:30
parent ef5a377bc6
commit a77b9d9027
2 changed files with 11 additions and 11 deletions

View file

@ -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();

View file

@ -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