fix displayname condition

This commit is contained in:
Ajay Bura 2025-01-26 16:14:09 +05:30
parent 8068dc2cbb
commit 03b0474a2c

View file

@ -28,7 +28,7 @@ export const useMemberEventParser = (): MemberEventParser => {
const senderName = getMxIdLocalPart(senderId); const senderName = getMxIdLocalPart(senderId);
const userName = const userName =
content.displayname && typeof content.displayname === 'string' typeof content.displayname === 'string'
? content.displayname || getMxIdLocalPart(userId) ? content.displayname || getMxIdLocalPart(userId)
: getMxIdLocalPart(userId); : getMxIdLocalPart(userId);
@ -179,14 +179,14 @@ export const useMemberEventParser = (): MemberEventParser => {
if (content.displayname !== prevContent.displayname) { if (content.displayname !== prevContent.displayname) {
const prevUserName = const prevUserName =
prevContent.displayname && typeof prevContent.displayname === 'string' typeof prevContent.displayname === 'string'
? prevContent.displayname || getMxIdLocalPart(userId) ? prevContent.displayname || getMxIdLocalPart(userId)
: getMxIdLocalPart(userId); : getMxIdLocalPart(userId);
return { return {
icon: Icons.Mention, icon: Icons.Mention,
body: body:
content.displayname && typeof content.displayname === 'string' ? ( typeof content.displayname === 'string' ? (
<> <>
<b>{prevUserName}</b> <b>{prevUserName}</b>
{' changed display name to '} {' changed display name to '}