fixed #76
This commit is contained in:
parent
18bd9d62cb
commit
c06a92e0ae
3 changed files with 10 additions and 6 deletions
|
@ -8,7 +8,7 @@ import dateFormat from 'dateformat';
|
||||||
import initMatrix from '../../../client/initMatrix';
|
import initMatrix from '../../../client/initMatrix';
|
||||||
import cons from '../../../client/state/cons';
|
import cons from '../../../client/state/cons';
|
||||||
import { redactEvent, sendReaction } from '../../../client/action/roomTimeline';
|
import { redactEvent, sendReaction } from '../../../client/action/roomTimeline';
|
||||||
import { getUsername, doesRoomHaveUnread } from '../../../util/matrixUtil';
|
import { getUsername, getUsernameOfRoomMember, doesRoomHaveUnread } from '../../../util/matrixUtil';
|
||||||
import colorMXID from '../../../util/colorMXID';
|
import colorMXID from '../../../util/colorMXID';
|
||||||
import { diffMinutes, isNotInSameDay } from '../../../util/common';
|
import { diffMinutes, isNotInSameDay } from '../../../util/common';
|
||||||
import { openEmojiBoard, openReadReceipts } from '../../../client/action/navigation';
|
import { openEmojiBoard, openReadReceipts } from '../../../client/action/navigation';
|
||||||
|
@ -358,7 +358,7 @@ function ChannelViewContent({
|
||||||
const userAvatar = isContentOnly ? null : (
|
const userAvatar = isContentOnly ? null : (
|
||||||
<Avatar
|
<Avatar
|
||||||
imageSrc={mEvent.sender.getAvatarUrl(initMatrix.matrixClient.baseUrl, 36, 36, 'crop')}
|
imageSrc={mEvent.sender.getAvatarUrl(initMatrix.matrixClient.baseUrl, 36, 36, 'crop')}
|
||||||
text={getUsername(mEvent.sender.userId).slice(0, 1)}
|
text={getUsernameOfRoomMember(mEvent.sender).slice(0, 1)}
|
||||||
bgColor={senderMXIDColor}
|
bgColor={senderMXIDColor}
|
||||||
size="small"
|
size="small"
|
||||||
/>
|
/>
|
||||||
|
@ -366,7 +366,7 @@ function ChannelViewContent({
|
||||||
const userHeader = isContentOnly ? null : (
|
const userHeader = isContentOnly ? null : (
|
||||||
<MessageHeader
|
<MessageHeader
|
||||||
userId={mEvent.sender.userId}
|
userId={mEvent.sender.userId}
|
||||||
name={getUsername(mEvent.sender.userId)}
|
name={getUsernameOfRoomMember(mEvent.sender)}
|
||||||
color={senderMXIDColor}
|
color={senderMXIDColor}
|
||||||
time={`${dateFormat(mEvent.getDate(), 'hh:MM TT')}`}
|
time={`${dateFormat(mEvent.getDate(), 'hh:MM TT')}`}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
||||||
import './PeopleDrawer.scss';
|
import './PeopleDrawer.scss';
|
||||||
|
|
||||||
import initMatrix from '../../../client/initMatrix';
|
import initMatrix from '../../../client/initMatrix';
|
||||||
import { getUsername } from '../../../util/matrixUtil';
|
import { getUsernameOfRoomMember } from '../../../util/matrixUtil';
|
||||||
import colorMXID from '../../../util/colorMXID';
|
import colorMXID from '../../../util/colorMXID';
|
||||||
import { openInviteUser } from '../../../client/action/navigation';
|
import { openInviteUser } from '../../../client/action/navigation';
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ function PeopleDrawer({ roomId }) {
|
||||||
key={member.userId}
|
key={member.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(member.userId)}
|
name={getUsernameOfRoomMember(member)}
|
||||||
color={colorMXID(member.userId)}
|
color={colorMXID(member.userId)}
|
||||||
peopleRole={getPowerLabel(member.powerLevel)}
|
peopleRole={getPowerLabel(member.powerLevel)}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -25,6 +25,10 @@ function getUsername(userId) {
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getUsernameOfRoomMember(roomMember) {
|
||||||
|
return roomMember.name || roomMember.userId;
|
||||||
|
}
|
||||||
|
|
||||||
async function isRoomAliasAvailable(alias) {
|
async function isRoomAliasAvailable(alias) {
|
||||||
try {
|
try {
|
||||||
const myUserId = initMatrix.matrixClient.getUserId();
|
const myUserId = initMatrix.matrixClient.getUserId();
|
||||||
|
@ -62,6 +66,6 @@ function doesRoomHaveUnread(room) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getBaseUrl, getUsername,
|
getBaseUrl, getUsername, getUsernameOfRoomMember,
|
||||||
isRoomAliasAvailable, doesRoomHaveUnread,
|
isRoomAliasAvailable, doesRoomHaveUnread,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue