Skip to content

Commit f9c01e9

Browse files
committed
more
1 parent 540a705 commit f9c01e9

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

app/lib/encryption/room.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ export default class EncryptionRoom {
314314
try {
315315
const decryptedOldGroupKeys = await this.exportOldRoomKeys(this.subscription?.oldRoomKeys);
316316
const result = await e2eGetUsersOfRoomWithoutKey(this.roomId);
317-
if (result.success) {
317+
if (result.users) {
318318
const { users } = result;
319319
if (!users.length) {
320320
return;

app/lib/hooks/useUserData.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ const useUserData = (rid: string) => {
2828
} else {
2929
try {
3030
const result = await getUserInfo(rid);
31-
if (result.success) {
31+
if (result.user) {
3232
const { user } = result;
3333
const username = useRealName && user.name ? user.name : user.username;
3434
setUser({
35-
username,
36-
avatar: user.username,
35+
username: username || '',
36+
avatar: user.username || '',
3737
uid: user._id,
3838
type: SubscriptionType.DIRECT,
3939
direct: true

app/lib/methods/canOpenRoom.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async function open({ type, rid, name }: { type: ERoomTypes; rid: string; name:
1717
// if the dm already exists it'll return the existent
1818
if (type === ERoomTypes.DIRECT && !rid) {
1919
const result = await createDirectMessage(name);
20-
if (result.success) {
20+
if (result.room) {
2121
const { room } = result;
2222
return {
2323
...room,
@@ -30,8 +30,7 @@ async function open({ type, rid, name }: { type: ERoomTypes; rid: string; name:
3030
if (type === ERoomTypes.GROUP) {
3131
try {
3232
// RC 0.61.0
33-
// @ts-ignore
34-
await sdk.post(`${restTypes[type]}.open`, params);
33+
await sdk.post(`/v1/groups.open`, params);
3534
} catch (e: any) {
3635
if (!(e.data && /is already open/.test(e.data.error))) {
3736
return false;
@@ -43,8 +42,7 @@ async function open({ type, rid, name }: { type: ERoomTypes; rid: string; name:
4342
// we'll get info from the room
4443
if ((type === ERoomTypes.CHANNEL || type === ERoomTypes.GROUP) && !rid) {
4544
// RC 0.72.0
46-
// @ts-ignore
47-
const result: any = await sdk.get(`${restTypes[type]}.info`, params);
45+
const result: any = await sdk.get(`/v1/${restTypes[type]}.info`, params);
4846
if (result.success) {
4947
const room = result[type];
5048
room.rid = room._id;

0 commit comments

Comments
 (0)