mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Create new tiles instead of keeping old ones
This commit is contained in:
parent
434882069e
commit
21b067eaff
@ -5,13 +5,23 @@ export class ComposerViewModel extends ViewModel {
|
|||||||
super();
|
super();
|
||||||
this._roomVM = roomVM;
|
this._roomVM = roomVM;
|
||||||
this._isEmpty = true;
|
this._isEmpty = true;
|
||||||
|
this._replyId = null;
|
||||||
this._replyVM = null;
|
this._replyVM = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
setReplyingTo(tile) {
|
setReplyingTo(entry) {
|
||||||
const changed = this._replyVM !== tile;
|
const newId = entry?.id || null;
|
||||||
this._replyVM = tile;
|
const changed = this._replyId !== newId;
|
||||||
if (changed) {
|
if (changed) {
|
||||||
|
this._replyId = newId;
|
||||||
|
if (this._replyVM) {
|
||||||
|
this.untrack(this._replyVM);
|
||||||
|
this._replyVM.dispose();
|
||||||
|
}
|
||||||
|
this._replyVM = entry && this._roomVM._createTile(entry);
|
||||||
|
if (this._replyVM) {
|
||||||
|
this.track(this._replyVM);
|
||||||
|
}
|
||||||
this.emitChange("replyViewModel");
|
this.emitChange("replyViewModel");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,6 +160,10 @@ export class RoomViewModel extends ViewModel {
|
|||||||
rejoinRoom() {
|
rejoinRoom() {
|
||||||
this._room.join();
|
this._room.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_createTile(entry) {
|
||||||
|
return this._tilesCreator(entry);
|
||||||
|
}
|
||||||
|
|
||||||
async _sendMessage(message, replyingTo) {
|
async _sendMessage(message, replyingTo) {
|
||||||
if (!this._room.isArchived && message) {
|
if (!this._room.isArchived && message) {
|
||||||
|
@ -107,7 +107,7 @@ export class BaseMessageTile extends SimpleTile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
startReply() {
|
startReply() {
|
||||||
this._roomVM.startReply(this);
|
this._roomVM.startReply(this._entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
reply(msgtype, body, log = null) {
|
reply(msgtype, body, log = null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user