mirror of
https://github.com/outline/outline.git
synced 2026-11-28 00:09:58 +03:00
fix: User filter order, title only icon, plurality
This commit is contained in:
3 files changed
+11
-5
No files matched your search
@@ -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]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user