Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] teams.removeMembers mobile usage #3557

Merged
merged 7 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions app/lib/rocketchat.js
Original file line number Diff line number Diff line change
Expand Up @@ -835,17 +835,21 @@ const RocketChat = {
// RC 3.13.0
return this.post('teams.removeRoom', { roomId, teamId });
},
leaveTeam({ teamName, rooms }) {
leaveTeam({ teamId, rooms }) {
// RC 3.13.0
return this.post('teams.leave', { teamName, rooms });
return this.post('teams.leave', {
teamId,
// RC 4.2.0
...(rooms?.length && { rooms })
});
},
removeTeamMember({ teamId, teamName, userId, rooms }) {
removeTeamMember({ teamId, userId, rooms }) {
// RC 3.13.0
return this.post('teams.removeMember', {
teamId,
teamName,
userId,
rooms
// RC 4.2.0
...(rooms?.length && { rooms })
});
},
updateTeamRoom({ roomId, isDefault }) {
Expand Down
2 changes: 1 addition & 1 deletion app/sagas/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const handleLeaveRoom = function* handleLeaveRoom({ room, roomType, selected })
if (roomType === 'channel') {
result = yield RocketChat.leaveRoom(room.rid, room.t);
} else if (roomType === 'team') {
result = yield RocketChat.leaveTeam({ teamName: room.name, ...(selected && { rooms: selected }) });
result = yield RocketChat.leaveTeam({ teamId: room.teamId, ...(selected && { rooms: selected }) });
}

if (result?.success) {
Expand Down
1 change: 0 additions & 1 deletion app/views/RoomMembersView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ class RoomMembersView extends React.Component {
const userId = selectedUser._id;
const result = await RocketChat.removeTeamMember({
teamId: room.teamId,
teamName: room.name,
userId,
...(selected && { rooms: selected })
});
Expand Down