display room mention text as they were sent

This commit is contained in:
Ajay Bura 2023-10-19 10:58:48 +05:30
parent 11ba1808a2
commit 2492bfa956
2 changed files with 2 additions and 5 deletions

View file

@ -74,7 +74,7 @@ const elementToInlineNode = (node: Element): MentionElement | EmoticonElement |
if (typeof href !== 'string') return undefined;
const [mxId] = parseMatrixToUrl(href);
if (mxId) {
return createMentionElement(mxId, mxId, false);
return createMentionElement(mxId, parseNodeText(node) || mxId, false);
}
}
return undefined;

View file

@ -180,10 +180,7 @@ export const getReactCustomHtmlParser = (
mentionPrefix === '#'
? getRoomWithCanonicalAlias(mx, mentionId)
: mx.getRoom(mentionId);
const mentionName = mentionRoom?.name;
const mentionDisplayName =
mentionName && (mentionName.startsWith('#') ? mentionName : `#${mentionName}`);
return (
<span
{...props}
@ -198,7 +195,7 @@ export const getReactCustomHtmlParser = (
onClick={params.handleMentionClick}
style={{ cursor: 'pointer' }}
>
{mentionDisplayName ?? mentionId}
{domToReact(children, opts)}
</span>
);
}