render message with no content as empty message

This commit is contained in:
Ajay Bura 2026-08-26 22:30:13 +05:30
commit 1d58c7a68d
3 changed files with 19 additions and 0 deletions

View file

@ -3,6 +3,7 @@ import { HTMLReactParserOptions } from 'html-react-parser';
import { Opts } from 'linkifyjs';
import { config } from 'folds';
import {
EmptyContent,
MAudio,
MEmote,
MFile,
@ -164,6 +165,10 @@ export function RenderMessageContent({
return <MLocation content={content} />;
}
if (Object.keys(content).length === 0) {
return <EmptyContent />;
}
return (
<MText
edited={edited}

View file

@ -13,6 +13,7 @@ import {
ReplyMNotice,
ReplyMText,
ReplyMLocation,
EmptyContent,
} from './message';
import { MsgType } from '../../types/matrix/common';
import { rContent } from '../../client/reader';
@ -124,6 +125,10 @@ export function RenderReplyContent({
return <ReplyMLocation content={content} />;
}
if (Object.keys(content).length === 0) {
return <EmptyContent size="T300" />;
}
return (
<ReplyMText
edited={edited}

View file

@ -16,6 +16,7 @@ import {
UnsupportedMessageEventType,
MessageUnsupportedContent,
VideoContent,
MessageEmptyContent,
} from './content';
import { FALLBACK_MIMETYPE, getBlobSafeMimeType } from '../../utils/mimeTypes';
import { parseGeoUri, scaleYDimension } from '../../utils/common';
@ -70,6 +71,14 @@ export function BrokenContent({ size }: TextProps) {
);
}
export function EmptyContent({ size }: TextProps) {
return (
<Text size={size}>
<MessageEmptyContent />
</Text>
);
}
type UrlPreviewProps = {
body: string;
ts: number;