Skip to content

Commit

Permalink
fix admin.searchRepos
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Sep 26, 2023
1 parent e2fd290 commit 0128640
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions packages/bsky/src/api/com/atproto/admin/searchRepos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,20 @@ export default function (server: Server, ctx: AppContext) {
handler: async ({ params }) => {
const db = ctx.db.getPrimary()
const moderationService = ctx.services.moderation(db)
const { invitedBy } = params
const { invitedBy, limit, cursor } = params
if (invitedBy) {
throw new InvalidRequestError('The invitedBy parameter is unsupported')
}
// prefer new 'q' query param over deprecated 'term'
const { q } = params
if (q) {
params.term = q
}
const query = params.q ?? params.term

const { results, cursor } = await ctx.services
const { results, cursor: resCursor } = await ctx.services
.actor(db)
.getSearchResults({ ...params, includeSoftDeleted: true })
.getSearchResults({ query, limit, cursor, includeSoftDeleted: true })
return {
encoding: 'application/json',
body: {
cursor,
cursor: resCursor,
repos: await moderationService.views.repo(results),
},
}
Expand Down

0 comments on commit 0128640

Please sign in to comment.