fixed inconsistent disply name
This commit is contained in:
parent
4d44562ada
commit
d98e213b92
5 changed files with 18 additions and 8 deletions
|
@ -149,7 +149,7 @@ function FollowingMembers({ roomId, roomTimeline, viewEvent }) {
|
||||||
return followingMembers.length !== 0 && (
|
return followingMembers.length !== 0 && (
|
||||||
<TimelineChange
|
<TimelineChange
|
||||||
variant="follow"
|
variant="follow"
|
||||||
content={getUsersActionJsx(followingMembers, 'following the conversation.')}
|
content={getUsersActionJsx(roomId, followingMembers, 'following the conversation.')}
|
||||||
time=""
|
time=""
|
||||||
onClick={() => openReadReceipts(roomId, lastMEvent.getId())}
|
onClick={() => openReadReceipts(roomId, lastMEvent.getId())}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -30,7 +30,7 @@ function ChannelViewFloating({
|
||||||
function getTypingMessage(members) {
|
function getTypingMessage(members) {
|
||||||
const userIds = members;
|
const userIds = members;
|
||||||
userIds.delete(mx.getUserId());
|
userIds.delete(mx.getUserId());
|
||||||
return getUsersActionJsx([...userIds], 'typing...');
|
return getUsersActionJsx(roomId, [...userIds], 'typing...');
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTyping(members) {
|
function updateTyping(members) {
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
& .btn-cmd-esc {
|
& .btn-cmd-esc {
|
||||||
display: none;
|
display: none;
|
||||||
margin: 0 var(--sp-extra-tight);
|
margin: 0 var(--sp-extra-tight);
|
||||||
padding: var(--sp-ultra-tight) var(--sp-tight);
|
padding: var(--sp-ultra-tight) var(--sp-extra-tight);
|
||||||
border-radius: calc(var(--bo-radius) / 2);
|
border-radius: calc(var(--bo-radius) / 2);
|
||||||
box-shadow: var(--bs-surface-border);
|
box-shadow: var(--bs-surface-border);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { getUsername } from '../../../util/matrixUtil';
|
import initMatrix from '../../../client/initMatrix';
|
||||||
|
import { getUsername, getUsernameOfRoomMember } from '../../../util/matrixUtil';
|
||||||
|
|
||||||
function getTimelineJSXMessages() {
|
function getTimelineJSXMessages() {
|
||||||
return {
|
return {
|
||||||
|
@ -134,8 +135,13 @@ function getTimelineJSXMessages() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUsersActionJsx(userIds, actionStr) {
|
function getUsersActionJsx(roomId, userIds, actionStr) {
|
||||||
const getUserJSX = (username) => <b>{getUsername(username)}</b>;
|
const room = initMatrix.matrixClient.getRoom(roomId);
|
||||||
|
const getUserDisplayName = (userId) => {
|
||||||
|
if (room?.getMember(userId)) return getUsernameOfRoomMember(room.getMember(userId));
|
||||||
|
return getUsername(userId);
|
||||||
|
};
|
||||||
|
const getUserJSX = (userId) => <b>{getUserDisplayName(userId)}</b>;
|
||||||
if (!Array.isArray(userIds)) return 'Idle';
|
if (!Array.isArray(userIds)) return 'Idle';
|
||||||
if (userIds.length === 0) return 'Idle';
|
if (userIds.length === 0) return 'Idle';
|
||||||
const MAX_VISIBLE_COUNT = 3;
|
const MAX_VISIBLE_COUNT = 3;
|
||||||
|
|
|
@ -3,7 +3,7 @@ import React, { useState, useEffect } from 'react';
|
||||||
import initMatrix from '../../../client/initMatrix';
|
import initMatrix from '../../../client/initMatrix';
|
||||||
import cons from '../../../client/state/cons';
|
import cons from '../../../client/state/cons';
|
||||||
import navigation from '../../../client/state/navigation';
|
import navigation from '../../../client/state/navigation';
|
||||||
import { getUsername } from '../../../util/matrixUtil';
|
import { getUsername, getUsernameOfRoomMember } from '../../../util/matrixUtil';
|
||||||
import colorMXID from '../../../util/colorMXID';
|
import colorMXID from '../../../util/colorMXID';
|
||||||
|
|
||||||
import IconButton from '../../atoms/button/IconButton';
|
import IconButton from '../../atoms/button/IconButton';
|
||||||
|
@ -51,12 +51,16 @@ function ReadReceipts() {
|
||||||
function renderPeople(receipt) {
|
function renderPeople(receipt) {
|
||||||
const room = initMatrix.matrixClient.getRoom(roomId);
|
const room = initMatrix.matrixClient.getRoom(roomId);
|
||||||
const member = room.getMember(receipt.userId);
|
const member = room.getMember(receipt.userId);
|
||||||
|
const getUserDisplayName = (userId) => {
|
||||||
|
if (room?.getMember(userId)) return getUsernameOfRoomMember(room.getMember(userId));
|
||||||
|
return getUsername(userId);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<PeopleSelector
|
<PeopleSelector
|
||||||
key={receipt.userId}
|
key={receipt.userId}
|
||||||
onClick={() => alert('Viewing profile is yet to be implemented')}
|
onClick={() => alert('Viewing profile is yet to be implemented')}
|
||||||
avatarSrc={member?.getAvatarUrl(initMatrix.matrixClient.baseUrl, 24, 24, 'crop')}
|
avatarSrc={member?.getAvatarUrl(initMatrix.matrixClient.baseUrl, 24, 24, 'crop')}
|
||||||
name={getUsername(receipt.userId)}
|
name={getUserDisplayName(receipt.userId)}
|
||||||
color={colorMXID(receipt.userId)}
|
color={colorMXID(receipt.userId)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue