Render error
This commit is contained in:
parent
687aa5a7e3
commit
46b69b3873
3 changed files with 17 additions and 2 deletions
|
@ -91,6 +91,10 @@ export class BaseMessageTile extends SimpleTile {
|
|||
return this._entry.isUnverified;
|
||||
}
|
||||
|
||||
get isReply() {
|
||||
return this._entry.isReply;
|
||||
}
|
||||
|
||||
_getContent() {
|
||||
return this._entry.content;
|
||||
}
|
||||
|
|
|
@ -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.")
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Reference in a new issue