diff --git a/client/src/components/commons/CommonsCatalog.tsx b/client/src/components/commons/CommonsCatalog.tsx index b050e172..b3594515 100644 --- a/client/src/components/commons/CommonsCatalog.tsx +++ b/client/src/components/commons/CommonsCatalog.tsx @@ -486,6 +486,16 @@ const CommonsCatalog = () => { return; } + // Authors and minirepos always use React Query (no browse endpoints) + if (activeTab === "authors") { + authorsSearch.fetchNextPage(); + return; + } + if (activeTab === "minirepos") { + miniReposSearch.fetchNextPage(); + return; + } + // In search mode, use React Query's fetchNextPage if (isSearchMode) { switch (activeTab) { @@ -498,12 +508,6 @@ const CommonsCatalog = () => { case "projects": if (isProjectsSearchMode) projectsSearch.fetchNextPage(); break; - case "authors": - authorsSearch.fetchNextPage(); - break; - case "minirepos": - miniReposSearch.fetchNextPage(); - break; } } else { // In browse mode, manually load more with incremented page diff --git a/client/src/components/commons/CommonsCatalog/CatalogCard/AuthorCardContent.tsx b/client/src/components/commons/CommonsCatalog/CatalogCard/AuthorCardContent.tsx index 40c60832..3934e80c 100644 --- a/client/src/components/commons/CommonsCatalog/CatalogCard/AuthorCardContent.tsx +++ b/client/src/components/commons/CommonsCatalog/CatalogCard/AuthorCardContent.tsx @@ -1,11 +1,11 @@ import { Card, CardContentProps, CardHeader } from "semantic-ui-react"; -import { ConductorSearchResponseAuthor } from "../../../../types"; +import { Author } from "../../../../types"; import { truncateString } from "../../../util/HelperFunctions"; import { useMemo } from "react"; import CardMetaWIcon from "../../../util/CardMetaWIcon"; interface AuthorCardContentProps extends CardContentProps { - author: ConductorSearchResponseAuthor; + author: Author; } const AuthorCardContent: React.FC = ({ @@ -29,26 +29,6 @@ const AuthorCardContent: React.FC = ({
{truncateString(author.companyName || author.programName || "", 50)}
)} - {author.projects?.length > 0 && ( - -
- {author.projects.map((p, idx) => ( - - {`${p.title}${ - author.projects.length > 1 && - idx !== author.projects.length - 1 - ? ", " - : "" - }`} - - ))} -
-
- )} {author.nameURL && (
diff --git a/client/src/components/commons/CommonsCatalog/CatalogCard/index.tsx b/client/src/components/commons/CommonsCatalog/CatalogCard/index.tsx index 75e8fb07..65645282 100644 --- a/client/src/components/commons/CommonsCatalog/CatalogCard/index.tsx +++ b/client/src/components/commons/CommonsCatalog/CatalogCard/index.tsx @@ -2,7 +2,7 @@ import { Link } from "react-router-dom"; import { Card, CardProps } from "semantic-ui-react"; import { Book, - ConductorSearchResponseAuthor, + Author, ConductorSearchResponseFile, Project, } from "../../../../types"; @@ -18,7 +18,7 @@ interface CatalogCardProps extends CardProps { | Book | ConductorSearchResponseFile | Project - | ConductorSearchResponseAuthor; + | Author; onDetailClick?: () => void; } diff --git a/client/src/components/commons/CommonsCatalog/DetailModal/index.tsx b/client/src/components/commons/CommonsCatalog/DetailModal/index.tsx index bdf229f6..60da8f89 100644 --- a/client/src/components/commons/CommonsCatalog/DetailModal/index.tsx +++ b/client/src/components/commons/CommonsCatalog/DetailModal/index.tsx @@ -1,7 +1,7 @@ import { Modal } from "semantic-ui-react"; import { Book, - ConductorSearchResponseAuthor, + Author, ConductorSearchResponseFile, Project, } from "../../../../types"; @@ -12,7 +12,7 @@ interface DetailModalProps { | Book | ConductorSearchResponseFile | Project - | ConductorSearchResponseAuthor; + | Author; open: boolean; onClose: () => void; } diff --git a/client/src/components/commons/CommonsCatalog/VisualMode.tsx b/client/src/components/commons/CommonsCatalog/VisualMode.tsx index 578a1225..36d97572 100644 --- a/client/src/components/commons/CommonsCatalog/VisualMode.tsx +++ b/client/src/components/commons/CommonsCatalog/VisualMode.tsx @@ -1,6 +1,6 @@ import { Book, - ConductorSearchResponseAuthor, + Author, ConductorSearchResponseFile, Project, } from "../../../types"; @@ -19,7 +19,7 @@ const VisualMode = ({ | Book | ConductorSearchResponseFile | Project - | ConductorSearchResponseAuthor + | Author )[]; loading?: boolean; noResultsMessage?: string; @@ -29,7 +29,7 @@ const VisualMode = ({ | Book | ConductorSearchResponseFile | Project - | ConductorSearchResponseAuthor + | Author | undefined >(undefined); diff --git a/client/src/context/CatalogContext.tsx b/client/src/context/CatalogContext.tsx index 9175f42a..4fc0553a 100644 --- a/client/src/context/CatalogContext.tsx +++ b/client/src/context/CatalogContext.tsx @@ -5,7 +5,7 @@ import type { Book, BookFilters, CommonsModule, - ConductorSearchResponseAuthor, + Author, ConductorSearchResponseFile, Project, ProjectFilters, @@ -51,7 +51,7 @@ export interface CatalogContextValue { miniRepos: CatalogEntityData; // Authors entity - authors: CatalogEntityData; + authors: CatalogEntityData; // Stop loading trigger (for infinite scroll) triggerStopLoading: () => void; diff --git a/client/src/types/Search.ts b/client/src/types/Search.ts index 62b2cf42..7d5f4beb 100644 --- a/client/src/types/Search.ts +++ b/client/src/types/Search.ts @@ -88,9 +88,6 @@ export type UserSearchParams = { sort?: "first" | "last"; } & _commonSearchParams; -export type ConductorSearchResponseAuthor = Author & { - projects: Pick[]; -}; export type ConductorSearchResponseFile = ProjectFileWProjectData< "title" | "thumbnail" | "description" | "projectURL" >; @@ -112,7 +109,7 @@ export type ConductorSearchResponse< : T extends "users" ? User[] : T extends "authors" - ? ConductorSearchResponseAuthor[] + ? Author[] : T extends "minirepos" ? Project[] : never; diff --git a/server/api/search.ts b/server/api/search.ts index 7237eeb3..21b01542 100644 --- a/server/api/search.ts +++ b/server/api/search.ts @@ -28,7 +28,6 @@ import Author from "../models/author.js"; import Fuse from "fuse.js"; import Organization from "../models/organization.js"; import AssetTagFramework from "../models/assettagframework.js"; -import authorsAPI from "./authors.js"; import SearchQuery, { SearchQueryInterface_Raw, } from "../models/searchquery.js"; @@ -37,7 +36,6 @@ import { _getBookPublicOrInstructorAssetsCount, buildOrganizationNamesList } fro import CustomCatalog, { CustomCatalogInterface } from "../models/customcatalog.js"; import { normalizedSort } from "../util/searchutils.js"; import SearchService from "./services/search-service.js"; -import AuthorService from "./services/author-service.js"; const searchQueryCache: SearchQueryInterface_Raw[] = []; // in-memory cache for search queries @@ -1892,7 +1890,6 @@ async function authorsSearch( nameKey: { $exists: true, $ne: null }, }, }, - AuthorService.LOOKUP_AUTHOR_PROJECTS_STAGE, { $project: { userUUID: 0, diff --git a/server/models/supporticketmessage.ts b/server/models/supporticketmessage.ts index 4dda619e..ff4d5316 100644 --- a/server/models/supporticketmessage.ts +++ b/server/models/supporticketmessage.ts @@ -67,6 +67,7 @@ SupportTicketMessageSchema.virtual("sender", { }); SupportTicketMessageSchema.index({ uuid: 1 }); +SupportTicketMessageSchema.index({ ticket: 1, type: 1, createdAt: -1 }); SupportTicketMessageSchema.set("toObject", { virtuals: true }); SupportTicketMessageSchema.set("toJSON", { virtuals: true });