mirror of
https://github.com/cinnyapp/cinny.git
synced 2024-11-20 14:59:55 +01:00
Fix crash in profile viewer
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
parent
a83b875b66
commit
41c72e0a8e
1 changed files with 3 additions and 3 deletions
|
@ -38,7 +38,7 @@ function ModerationTools({
|
||||||
const room = mx.getRoom(roomId);
|
const room = mx.getRoom(roomId);
|
||||||
const roomMember = room.getMember(userId);
|
const roomMember = room.getMember(userId);
|
||||||
|
|
||||||
const myPowerLevel = room.getMember(mx.getUserId()).powerLevel;
|
const myPowerLevel = room.getMember(mx.getUserId())?.powerLevel || 0;
|
||||||
const powerLevel = roomMember?.powerLevel || 0;
|
const powerLevel = roomMember?.powerLevel || 0;
|
||||||
const canIKick = (
|
const canIKick = (
|
||||||
roomMember?.membership === 'join'
|
roomMember?.membership === 'join'
|
||||||
|
@ -159,7 +159,7 @@ function ProfileFooter({ roomId, userId, onRequestClose }) {
|
||||||
const [isInviting, setIsInviting] = useState(false);
|
const [isInviting, setIsInviting] = useState(false);
|
||||||
const [isInvited, setIsInvited] = useState(member?.membership === 'invite');
|
const [isInvited, setIsInvited] = useState(member?.membership === 'invite');
|
||||||
|
|
||||||
const myPowerlevel = room.getMember(mx.getUserId()).powerLevel;
|
const myPowerlevel = room.getMember(mx.getUserId())?.powerLevel || 0;
|
||||||
const userPL = room.getMember(userId)?.powerLevel || 0;
|
const userPL = room.getMember(userId)?.powerLevel || 0;
|
||||||
const canIKick = room.currentState.hasSufficientPowerLevelFor('kick', myPowerlevel) && userPL < myPowerlevel;
|
const canIKick = room.currentState.hasSufficientPowerLevelFor('kick', myPowerlevel) && userPL < myPowerlevel;
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ function ProfileViewer() {
|
||||||
const avatarMxc = roomMember?.getMxcAvatarUrl?.() || mx.getUser(userId)?.avatarUrl;
|
const avatarMxc = roomMember?.getMxcAvatarUrl?.() || mx.getUser(userId)?.avatarUrl;
|
||||||
const avatarUrl = (avatarMxc && avatarMxc !== 'null') ? mx.mxcUrlToHttp(avatarMxc, 80, 80, 'crop') : null;
|
const avatarUrl = (avatarMxc && avatarMxc !== 'null') ? mx.mxcUrlToHttp(avatarMxc, 80, 80, 'crop') : null;
|
||||||
|
|
||||||
const powerLevel = roomMember.powerLevel || 0;
|
const powerLevel = roomMember?.powerLevel || 0;
|
||||||
const myPowerLevel = room.getMember(mx.getUserId())?.powerLevel || 0;
|
const myPowerLevel = room.getMember(mx.getUserId())?.powerLevel || 0;
|
||||||
|
|
||||||
const canChangeRole = (
|
const canChangeRole = (
|
||||||
|
|
Loading…
Reference in a new issue