fix: User filter order, title only icon, plurality

This commit is contained in:
Tom Moor committed 2026-11-14 12:37:42 -05:00
1 parent c3274d17d1
commit c51ba1ead7
3 files changed
+11 -5

No files matched your search

+8 -2
View File
@@ -10,6 +10,7 @@ import type { TFilterOption } from "~/components/FilterOptions";
import CollectionIcon from "~/components/Icons/CollectionIcon";
import type { PaginatedItem } from "~/components/PaginatedList";
import useCurrentTeam from "~/hooks/useCurrentTeam";
import useCurrentUser from "~/hooks/useCurrentUser";
import usePolicy from "~/hooks/usePolicy";
import useStores from "~/hooks/useStores";
import type { FetchPageParams } from "~/stores/base/Store";
@@ -51,18 +52,23 @@ export function useCollectionOptions(): FilterOptionSource {
/**
* Options for each user in the workspace, loaded from the server as needed.
* The current user is the first option.
*
* @returns the user options.
*/
export function useUserOptions(): FilterOptionSource {
const { users } = useStores();
const team = useCurrentTeam();
const currentUserId = useCurrentUser({ rejectOnEmpty: false })?.id;
const can = usePolicy(team);
const fetchQuery = can.listUsers ? users.fetchPage : undefined;
return useMemo(
() => ({
options: users.all.map((user) => ({
options: [
...users.all.filter((user) => user.id === currentUserId),
...users.all.filter((user) => user.id !== currentUserId),
].map((user) => ({
key: user.id,
label: user.name,
icon: <StyledAvatar model={user} size={AvatarSize.Small} />,
@@ -71,7 +77,7 @@ export function useUserOptions(): FilterOptionSource {
fetchQueryOptions: userFetchQueryOptions,
showFilter: true,
}),
[users.all, fetchQuery]
[users.all, currentUserId, fetchQuery]
);
}
+2 -2
View File
@@ -4,7 +4,7 @@ import {
DoneIcon,
EditIcon,
NewDocumentIcon,
TextWrapIcon,
CaseSensitiveIcon,
UserIcon,
} from "outline-icons";
import { endOfDay, startOfDay } from "date-fns";
@@ -226,7 +226,7 @@ export function createSearchFilters(t: TFunction): SearchFilter[] {
type: "toggle",
id: "titleOnly",
label: t("Title only"),
icon: <TextWrapIcon />,
icon: <CaseSensitiveIcon />,
legacyParam: "titleFilter",
},
];
+1 -1
View File
@@ -1244,7 +1244,7 @@
"Past month": "Past month",
"Past year": "Past year",
"{{ count }} result": "{{ count }} result",
"{{ count }} result_plural": "{{ count }} result",
"{{ count }} result_plural": "{{ count }} results",
"Please try again or contact support if the problem persists": "Please try again or contact support if the problem persists",
"No documents found for your search filters.": "No documents found for your search filters.",
"Edited by": "Edited by",