mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 19:45:05 +01:00
No need to pass tileCreator as argument
This commit is contained in:
parent
e0dc853d74
commit
df22db256b
@ -150,7 +150,7 @@ export class TilesCollection extends BaseObservableList {
|
|||||||
const tileIdx = this._findTileIdx(entry);
|
const tileIdx = this._findTileIdx(entry);
|
||||||
const tile = this._findTileAtIdx(entry, tileIdx);
|
const tile = this._findTileAtIdx(entry, tileIdx);
|
||||||
if (tile) {
|
if (tile) {
|
||||||
const action = tile.updateEntry(entry, params, this._tileCreator);
|
const action = tile.updateEntry(entry, params);
|
||||||
if (action.shouldReplace) {
|
if (action.shouldReplace) {
|
||||||
const newTile = this._tileCreator(entry);
|
const newTile = this._tileCreator(entry);
|
||||||
if (newTile) {
|
if (newTile) {
|
||||||
|
@ -110,8 +110,8 @@ export class BaseMessageTile extends SimpleTile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateEntry(entry, param, tileCreator) {
|
updateEntry(entry, param) {
|
||||||
const action = super.updateEntry(entry, param, tileCreator);
|
const action = super.updateEntry(entry, param);
|
||||||
if (action.shouldUpdate) {
|
if (action.shouldUpdate) {
|
||||||
this._updateReactions();
|
this._updateReactions();
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import {SendStatus} from "../../../../../matrix/room/sending/PendingEvent.js";
|
|||||||
export class SimpleTile extends ViewModel {
|
export class SimpleTile extends ViewModel {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
super(options);
|
super(options);
|
||||||
|
this._tileCreator = options.tileCreator;
|
||||||
this._entry = options.entry;
|
this._entry = options.entry;
|
||||||
}
|
}
|
||||||
// view model props for all subclasses
|
// 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
|
// update received for already included (falls within sort keys) entry
|
||||||
updateEntry(entry, param, tileCreator) {
|
updateEntry(entry, param) {
|
||||||
const replyEntry = param?.reply ?? entry.contextEntry;
|
const replyEntry = param?.reply ?? entry.contextEntry;
|
||||||
if (replyEntry) {
|
if (replyEntry) {
|
||||||
// this is an update to contextEntry used for replyPreview
|
// this is an update to contextEntry used for replyPreview
|
||||||
const action = this._replyTextTile?.updateEntry(replyEntry);
|
const action = this._replyTextTile?.updateEntry(replyEntry);
|
||||||
if (action?.shouldReplace) {
|
if (action?.shouldReplace) {
|
||||||
this._replyTextTile = tileCreator(replyEntry);
|
this._replyTextTile = this._tileCreator(replyEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const renderedAsRedacted = this.shape === "redacted";
|
const renderedAsRedacted = this.shape === "redacted";
|
||||||
|
@ -22,7 +22,6 @@ export class TextTile extends BaseTextTile {
|
|||||||
|
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
super(options);
|
super(options);
|
||||||
this._tileCreator = options.tileCreator;
|
|
||||||
this._replyTextTile = null;
|
this._replyTextTile = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user