Skip to content

Commit

Permalink
replace deprecated method
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbura committed Feb 9, 2025
1 parent 907e006 commit 01c5287
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/app/organisms/profile-viewer/ProfileViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ function SessionInfo({ userId }) {

async function loadDevices() {
try {
await mx.downloadKeys([userId], true);
const myDevices = mx.getStoredDevicesForUser(userId);
const crypto = mx.getCrypto();
const userToDevices = await crypto.getUserDeviceInfo([userId], true);
const myDevices = Array.from(userToDevices.get(userId).values());

if (isUnmounted) return;
setDevices(myDevices);
Expand All @@ -127,7 +128,7 @@ function SessionInfo({ userId }) {
<Chip
key={device.deviceId}
iconSrc={ShieldEmptyIC}
text={device.getDisplayName() || device.deviceId}
text={device.displayName || device.deviceId}
/>
))}
</div>
Expand Down Expand Up @@ -175,7 +176,7 @@ function ProfileFooter({ roomId, userId, onRequestClose }) {
const roomState = room.getLiveTimeline().getState(EventTimeline.FORWARDS);

const canIKick =
roomState?.hasSufficientPowerLevelFor('kick', myPowerlevel) && userPL < myPowerlevel;
roomState?.hasSufficientPowerLevelFor('kick', myPowerlevel) && userPL < myPowerlevel;

const isBanned = member?.membership === 'ban';

Expand Down
4 changes: 2 additions & 2 deletions src/util/matrixUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ export function getSSKeyInfo(mx, key) {

export async function hasDevices(mx, userId) {
try {
const usersDeviceMap = await mx.downloadKeys([userId, mx.getUserId()]);
const usersDeviceMap = await mx.getUserDeviceInfo([userId, mx.getUserId()]);
return Object.values(usersDeviceMap)
.every((userDevices) => (Object.keys(userDevices).length > 0));
.every((deviceIdToDevices) => deviceIdToDevices.size > 0);
} catch (e) {
console.error("Error determining if it's possible to encrypt to all users: ", e);
return false;
Expand Down

0 comments on commit 01c5287

Please sign in to comment.