No need to pass tileCreator as argument

This commit is contained in:
RMidhunSuresh 2021-12-16 15:32:57 +05:30
parent e0dc853d74
commit df22db256b
4 changed files with 6 additions and 6 deletions

View File

@ -150,7 +150,7 @@ export class TilesCollection extends BaseObservableList {
const tileIdx = this._findTileIdx(entry);
const tile = this._findTileAtIdx(entry, tileIdx);
if (tile) {
const action = tile.updateEntry(entry, params, this._tileCreator);
const action = tile.updateEntry(entry, params);
if (action.shouldReplace) {
const newTile = this._tileCreator(entry);
if (newTile) {

View File

@ -110,8 +110,8 @@ export class BaseMessageTile extends SimpleTile {
}
}
updateEntry(entry, param, tileCreator) {
const action = super.updateEntry(entry, param, tileCreator);
updateEntry(entry, param) {
const action = super.updateEntry(entry, param);
if (action.shouldUpdate) {
this._updateReactions();
}

View File

@ -21,6 +21,7 @@ import {SendStatus} from "../../../../../matrix/room/sending/PendingEvent.js";
export class SimpleTile extends ViewModel {
constructor(options) {
super(options);
this._tileCreator = options.tileCreator;
this._entry = options.entry;
}
// view model props for all subclasses
@ -96,13 +97,13 @@ export class SimpleTile extends ViewModel {
}
// update received for already included (falls within sort keys) entry
updateEntry(entry, param, tileCreator) {
updateEntry(entry, param) {
const replyEntry = param?.reply ?? entry.contextEntry;
if (replyEntry) {
// this is an update to contextEntry used for replyPreview
const action = this._replyTextTile?.updateEntry(replyEntry);
if (action?.shouldReplace) {
this._replyTextTile = tileCreator(replyEntry);
this._replyTextTile = this._tileCreator(replyEntry);
}
}
const renderedAsRedacted = this.shape === "redacted";

View File

@ -22,7 +22,6 @@ export class TextTile extends BaseTextTile {
constructor(options) {
super(options);
this._tileCreator = options.tileCreator;
this._replyTextTile = null;
}