mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Move update logic to BaseMessageTile
This commit is contained in:
parent
ef5a377bc6
commit
a77b9d9027
@ -116,6 +116,17 @@ export class BaseMessageTile extends SimpleTile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateEntry(entry, param) {
|
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);
|
const action = super.updateEntry(entry, param);
|
||||||
if (action.shouldUpdate) {
|
if (action.shouldUpdate) {
|
||||||
this._updateReactions();
|
this._updateReactions();
|
||||||
|
@ -94,17 +94,6 @@ 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) {
|
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";
|
const renderedAsRedacted = this.shape === "redacted";
|
||||||
if (!entry.isGap && entry.isRedacted !== renderedAsRedacted) {
|
if (!entry.isGap && entry.isRedacted !== renderedAsRedacted) {
|
||||||
// recreate the tile if the entry becomes redacted
|
// recreate the tile if the entry becomes redacted
|
||||||
|
Loading…
Reference in New Issue
Block a user