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] "Match error" when converting a team to a channel #24629

Merged
merged 3 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions app/api/server/v1/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ API.v1.addRoute(
this.queryParams,
Match.ObjectIncluding({
userId: String,
canUserDelete: Match.Maybe(Boolean),
canUserDelete: Match.Maybe(String),
}),
);

Expand All @@ -356,7 +356,8 @@ API.v1.addRoute(
return API.v1.unauthorized();
}

const { records, total } = await Team.listRoomsOfUser(this.userId, team._id, userId, allowPrivateTeam, canUserDelete ?? false, {
const booleanCanUserDelete = canUserDelete === 'true';
const { records, total } = await Team.listRoomsOfUser(this.userId, team._id, userId, allowPrivateTeam, booleanCanUserDelete, {
offset,
count,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const ConvertToChannelModal: FC<ConvertToChannelModalProps> = ({ onClose, onCanc

const { value, phase } = useEndpointData(
'teams.listRoomsOfUser',
useMemo(() => ({ teamId, userId, canUserDelete: true }), [teamId, userId]),
useMemo(() => ({ teamId, userId, canUserDelete: 'true' }), [teamId, userId]),
);

if (phase === AsyncStatePhase.LOADING) {
Expand Down
4 changes: 2 additions & 2 deletions definition/rest/v1/teams/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ export type TeamsEndpoints = {
| {
teamId: ITeam['_id'];
userId: IUser['_id'];
canUserDelete?: boolean;
canUserDelete?: string;
}
| {
teamName: ITeam['name'];
userId: IUser['_id'];
canUserDelete?: boolean;
canUserDelete?: string;
},
) => PaginatedResult & { rooms: IRoom[] };
};
Expand Down