mirror of
https://github.com/outline/outline.git
synced 2026-05-07 18:41:12 -05:00
fix: Query not taken into account when filtering groups, closes #7291
This commit is contained in:
@@ -25,7 +25,7 @@ router.post(
|
||||
pagination(),
|
||||
validate(T.GroupsListSchema),
|
||||
async (ctx: APIContext<T.GroupsListReq>) => {
|
||||
const { direction, sort, userId, name } = ctx.input.body;
|
||||
const { sort, direction, query, userId, name } = ctx.input.body;
|
||||
const { user } = ctx.state.auth;
|
||||
authorize(user, "listGroups", user.team);
|
||||
|
||||
@@ -40,6 +40,13 @@ router.post(
|
||||
[Op.eq]: name,
|
||||
},
|
||||
};
|
||||
} else if (query) {
|
||||
where = {
|
||||
...where,
|
||||
name: {
|
||||
[Op.iLike]: `%${query}%`,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const groups = await Group.filterByMember(userId).findAll({
|
||||
|
||||
@@ -25,8 +25,11 @@ export const GroupsListSchema = z.object({
|
||||
/** Only list groups where this user is a member */
|
||||
userId: z.string().uuid().optional(),
|
||||
|
||||
/** Find group with matching name */
|
||||
/** @deprecated Find group with matching name */
|
||||
name: z.string().optional(),
|
||||
|
||||
/** Find group matching query */
|
||||
query: z.string().optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user