Render error

This commit is contained in:
RMidhunSuresh 2021-12-20 12:06:21 +05:30
parent 687aa5a7e3
commit 46b69b3873
3 changed files with 17 additions and 2 deletions

View file

@ -91,6 +91,10 @@ export class BaseMessageTile extends SimpleTile {
return this._entry.isUnverified;
}
get isReply() {
return this._entry.isReply;
}
_getContent() {
return this._entry.content;
}

View file

@ -41,3 +41,11 @@ export class ReplyPreviewView extends TemplateView {
]);
}
}
export class ReplyPreviewError extends TemplateView {
render(t) {
return t.blockquote({ className: "ReplyPreviewView" }, [
t.div({ className: "Timeline_messageBody statusMessage" }, "This reply could not be found.")
]);
}
}

View file

@ -16,7 +16,7 @@ limitations under the License.
import {tag, text} from "../../../general/html";
import {BaseMessageView} from "./BaseMessageView.js";
import {ReplyPreviewView} from "./ReplyPreviewView.js";
import {ReplyPreviewError, ReplyPreviewView} from "./ReplyPreviewView.js";
export class TextMessageView extends BaseMessageView {
renderMessageBody(t, vm) {
@ -27,7 +27,10 @@ export class TextMessageView extends BaseMessageView {
statusMessage: vm => vm.shape === "message-status",
}
}, t.mapView(vm => vm.replyTextTile, replyTextTile => {
if (replyTextTile && this._interactive) {
if (vm.isReply && !replyTextTile) {
return new ReplyPreviewError();
}
else if (replyTextTile && this._interactive) {
// if this._interactive = false, this is already a reply preview, don't nest replies for now.
return new ReplyPreviewView(replyTextTile);
}