diff --git a/app/lib/rocketchat.js b/app/lib/rocketchat.js index 02e0cf10..4fd4bdb5 100644 --- a/app/lib/rocketchat.js +++ b/app/lib/rocketchat.js @@ -1039,7 +1039,7 @@ const RocketChat = { } return this.post('subscriptions.read', { rid: roomId }); }, - getRoomMembers({ rid, allUsers, roomType, type, filter, skip = 0, limit = 10 }) { + async getRoomMembers({ rid, allUsers, roomType, type, filter, skip = 0, limit = 10 }) { const serverVersion = reduxStore.getState().server.version; if (compareServerVersion(serverVersion, '3.16.0', methods.greaterThanOrEqualTo)) { const params = { @@ -1050,10 +1050,12 @@ const RocketChat = { ...(filter && { filter }) }; // RC 3.16.0 - return this.sdk.get(`${this.roomTypeToApiType(roomType)}.members`, params); + const result = await this.sdk.get(`${this.roomTypeToApiType(roomType)}.members`, params); + return result?.members; } // RC 0.42.0 - return this.methodCallWrapper('getUsersOfRoom', rid, allUsers, { skip, limit }); + const result = await this.methodCallWrapper('getUsersOfRoom', rid, allUsers, { skip, limit }); + return result?.records; }, methodCallWrapper(method, ...params) { const { API_Use_REST_For_DDP_Calls } = reduxStore.getState().settings; diff --git a/app/views/RoomMembersView/index.js b/app/views/RoomMembersView/index.js index c4a5ca7a..30894698 100644 --- a/app/views/RoomMembersView/index.js +++ b/app/views/RoomMembersView/index.js @@ -434,7 +434,6 @@ class RoomMembersView extends React.Component { fetchMembers = async () => { const { rid, members, isLoading, allUsers, end, room, filtering } = this.state; const { t } = room; - let newMembers; if (isLoading || end) { return; } @@ -449,11 +448,10 @@ class RoomMembersView extends React.Component { skip: members.length, limit: PAGE_SIZE }); - newMembers = membersResult.members; this.setState({ - members: members.concat(newMembers || []), + members: members.concat(membersResult || []), isLoading: false, - end: newMembers.length < PAGE_SIZE + end: membersResult?.length < PAGE_SIZE }); this.setHeader(); } catch (e) {