Spaces:
Running
Running
Only require featured assistants for other users' assistants (#1054)
Browse files
src/routes/api/assistants/+server.ts
CHANGED
@@ -14,10 +14,9 @@ export async function GET({ url, locals }) {
|
|
14 |
const query = url.searchParams.get("q")?.trim() ?? null;
|
15 |
const createdByCurrentUser = locals.user?.username && locals.user.username === username;
|
16 |
|
17 |
-
const shouldBeFeatured =
|
18 |
-
const shouldHaveBeenShared =
|
19 |
REQUIRE_FEATURED_ASSISTANTS === "true" && !createdByCurrentUser
|
20 |
-
? { userCount: { $gt: 1 } }
|
21 |
: {};
|
22 |
|
23 |
let user: Pick<User, "_id"> | null = null;
|
@@ -37,7 +36,6 @@ export async function GET({ url, locals }) {
|
|
37 |
...(user && { createdById: user._id }),
|
38 |
...(query && { searchTokens: { $all: generateQueryTokens(query) } }),
|
39 |
...shouldBeFeatured,
|
40 |
-
...shouldHaveBeenShared,
|
41 |
};
|
42 |
const assistants = await collections.assistants
|
43 |
.find(filter)
|
|
|
14 |
const query = url.searchParams.get("q")?.trim() ?? null;
|
15 |
const createdByCurrentUser = locals.user?.username && locals.user.username === username;
|
16 |
|
17 |
+
const shouldBeFeatured =
|
|
|
18 |
REQUIRE_FEATURED_ASSISTANTS === "true" && !createdByCurrentUser
|
19 |
+
? { featured: true, userCount: { $gt: 1 } }
|
20 |
: {};
|
21 |
|
22 |
let user: Pick<User, "_id"> | null = null;
|
|
|
36 |
...(user && { createdById: user._id }),
|
37 |
...(query && { searchTokens: { $all: generateQueryTokens(query) } }),
|
38 |
...shouldBeFeatured,
|
|
|
39 |
};
|
40 |
const assistants = await collections.assistants
|
41 |
.find(filter)
|
src/routes/assistants/+page.server.ts
CHANGED
@@ -21,10 +21,9 @@ export const load = async ({ url, locals }) => {
|
|
21 |
const sort = url.searchParams.get("sort")?.trim() ?? SortKey.POPULAR;
|
22 |
const createdByCurrentUser = locals.user?.username && locals.user.username === username;
|
23 |
|
24 |
-
const shouldBeFeatured =
|
25 |
-
const shouldHaveBeenShared =
|
26 |
REQUIRE_FEATURED_ASSISTANTS === "true" && !createdByCurrentUser
|
27 |
-
? { userCount: { $gt: 1 } }
|
28 |
: {};
|
29 |
|
30 |
let user: Pick<User, "_id"> | null = null;
|
@@ -43,7 +42,6 @@ export const load = async ({ url, locals }) => {
|
|
43 |
...(modelId && { modelId }),
|
44 |
...(user && { createdById: user._id }),
|
45 |
...(query && { searchTokens: { $all: generateQueryTokens(query) } }),
|
46 |
-
...shouldHaveBeenShared,
|
47 |
...shouldBeFeatured,
|
48 |
};
|
49 |
const assistants = await collections.assistants
|
|
|
21 |
const sort = url.searchParams.get("sort")?.trim() ?? SortKey.POPULAR;
|
22 |
const createdByCurrentUser = locals.user?.username && locals.user.username === username;
|
23 |
|
24 |
+
const shouldBeFeatured =
|
|
|
25 |
REQUIRE_FEATURED_ASSISTANTS === "true" && !createdByCurrentUser
|
26 |
+
? { featured: true, userCount: { $gt: 1 } }
|
27 |
: {};
|
28 |
|
29 |
let user: Pick<User, "_id"> | null = null;
|
|
|
42 |
...(modelId && { modelId }),
|
43 |
...(user && { createdById: user._id }),
|
44 |
...(query && { searchTokens: { $all: generateQueryTokens(query) } }),
|
|
|
45 |
...shouldBeFeatured,
|
46 |
};
|
47 |
const assistants = await collections.assistants
|