Skip to content

Commit 8f01bf4

Browse files
committed
Prioritize caller's projects
1 parent 793d698 commit 8f01bf4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Share/Postgres/Queries.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ searchProjects caller userIdFilter (Query query) limit = do
179179
p.slug ILIKE (like_escape(#{query}) || '%') DESC,
180180
-- Otherwise infix matches
181181
p.slug ILIKE ('%' || like_escape(#{query}) || '%') DESC,
182+
-- Prefer the caller's projects
183+
COALESCE(FALSE, p.owner_user_id = #{caller}) DESC,
184+
-- If a user has access to a private project, it's likely relevant
185+
p.private DESC,
182186
-- Prefer projects in the unison org
183187
COALESCE(FALSE, p.owner_user_id = (SELECT unison.id FROM users unison WHERE unison.handle = 'unison')) DESC,
184188
-- Prefer projects in the catalog

0 commit comments

Comments
 (0)