Skip to content

Commit 99f3459

Browse files
committed
Remove user followers in search-users
1 parent 75fbc96 commit 99f3459

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

backend/api/src/search-users.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ export const searchUsers: APIHandler<'search-users'> = async (props, auth) => {
2020
const pg = createSupabaseDirectClient()
2121

2222
const offset = page * limit
23-
const userId = auth?.uid
24-
const searchFollowersSQL = getSearchUserSQL({ term, offset, limit, userId })
23+
// const userId = auth?.uid
24+
// const searchFollowersSQL = getSearchUserSQL({ term, offset, limit, userId })
2525
const searchAllSQL = getSearchUserSQL({ term, offset, limit })
26-
const [followers, all] = await Promise.all([
27-
pg.map(searchFollowersSQL, null, convertUser),
26+
const [all] = await Promise.all([
27+
// pg.map(searchFollowersSQL, null, convertUser),
2828
pg.map(searchAllSQL, null, convertUser),
2929
])
3030

31-
return uniqBy([...followers, ...all], 'id')
31+
return uniqBy([...all], 'id')
3232
.map(toUserAPIResponse)
3333
.slice(0, limit)
3434
}
@@ -39,17 +39,18 @@ function getSearchUserSQL(props: {
3939
limit: number
4040
userId?: string // search only this user's followers
4141
}) {
42-
const { term, userId } = props
42+
const { term } = props
4343

4444
return renderSql(
45-
userId
46-
? [
47-
select('users.*'),
48-
from('users'),
49-
join('user_follows on user_follows.follow_id = users.id'),
50-
where('user_follows.user_id = $1', [userId]),
51-
]
52-
: [select('*'), from('users')],
45+
// userId
46+
// ? [
47+
// select('users.*'),
48+
// from('users'),
49+
// join('user_follows on user_follows.follow_id = users.id'),
50+
// where('user_follows.user_id = $1', [userId]),
51+
// ]
52+
// :
53+
[select('*'), from('users')],
5354
term
5455
? [
5556
where(

0 commit comments

Comments
 (0)