Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix: bound workspace refresh work and include API helper tests

Tin3f71adcac63c
diff --git a/apps/api/src/activity/controllers/get-workspace-activities.ts b/apps/api/src/activity/controllers/get-workspace-activities.ts
index 41d3207ec..de1c58309 100644
--- a/apps/api/src/activity/controllers/get-workspace-activities.ts
+++ b/apps/api/src/activity/controllers/get-workspace-activities.ts
@@ -1,4 +1,4 @@
-import { and, desc, eq, gte, isNull } from "drizzle-orm";
+import { and, desc, eq, gte, inArray, isNull } from "drizzle-orm";
import db from "../../database";
import {
activityTable,
@@ -17,6 +17,20 @@ const WINDOW_DAYS = 30;
async function getWorkspaceActivities(workspaceId: string) {
const since = new Date(Date.now() - WINDOW_DAYS * 24 * 60 * 60 * 1000);
+ // Concrete project IDs let PostgreSQL estimate task selectivity before it
+ // chooses an activity index. A join-only workspace filter can instead scan
+ // every tenant's recent events to fill a quiet workspace's small feed.
+ const projects = await db
+ .select({ id: projectTable.id })
+ .from(projectTable)
+ .where(
+ and(
+ eq(projectTable.workspaceId, workspaceId),
+ isNull(projectTable.archivedAt),
+ ),
+ );
+ if (!projects.length) return [];
+
const rows = await db
.select({
id: activityTable.id,
@@ -42,6 +56,10 @@ async function getWorkspaceActivities(workspaceId: string) {
.where(
and(
eq(projectTable.workspaceId, workspaceId),
+ inArray(
+ taskTable.projectId,
+ projects.map((project) => project.id),
+ ),
isNull(projectTable.archivedAt),
gte(activityTable.createdAt, since),
),
diff --git a/apps/api/src/task/controllers/get-assigned-tasks.ts b/apps/api/src/task/controllers/get-assigned-tasks.ts
index 105db4a94..6ffc90f22 100644
--- a/apps/api/src/task/controllers/get-assigned-tasks.ts
+++ b/apps/api/src/task/controllers/get-assigned-tasks.ts
@@ -29,7 +29,11 @@ const priorityRank = sql<number>`CASE
ELSE 0
END`;
-async function getAssignedTasks(workspaceId: string, userId: string) {
+async function getAssignedTasks(
+ workspaceId: string,
+ userId: string,
+ countOnly = false,
+) {
const openAndMine = and(
eq(projectTable.workspaceId, workspaceId),
isNull(projectTable.archivedAt),
@@ -38,6 +42,17 @@ async function getAssignedTasks(workspaceId: string, userId: string) {
sql`not ${taskIsCompleted}`,
);
+ const totalsQuery = db
+ .select({ total: count() })
+ .from(taskTable)
+ .innerJoin(projectTable, eq(taskTable.projectId, projectTable.id))
+ .where(openAndMine);
+
+ if (countOnly) {
+ const [totals] = await totalsQuery;
+ return { tasks: [], total: Number(totals?.total ?? 0) };
+ }
+
// Existing databases may contain duplicate slugs from concurrent column
// creation. A lateral lookup must return at most one decoration per task.
const statusColumn = db
@@ -85,11 +100,7 @@ async function getAssignedTasks(workspaceId: string, userId: string) {
asc(taskTable.id),
)
.limit(ASSIGNED_TASKS_LIMIT),
- db
- .select({ total: count() })
- .from(taskTable)
- .innerJoin(projectTable, eq(taskTable.projectId, projectTable.id))
- .where(openAndMine),
+ totalsQuery,
]);
const labels = tasks.length
diff --git a/apps/api/src/task/index.ts b/apps/api/src/task/index.ts
index 5dbe12212..d5350a682 100644
--- a/apps/api/src/task/index.ts
+++ b/apps/api/src/task/index.ts
@@ -116,12 +116,12 @@ const listAssignedTasksRoute = createRoute({
tags: ["Tasks"],
summary: "List my assigned tasks",
description:
- "Get the open tasks assigned to the caller across a workspace's active projects. Completed and archived tasks are excluded. Ordered by due date (undated last), then priority. At most 100 tasks are returned; total counts all of them.",
+ "Get the open tasks assigned to the caller across a workspace's active projects. Completed and archived tasks are excluded. Ordered by due date (undated last), then priority. At most 100 tasks are returned; total counts all of them. Set countOnly=true to return just that total without loading task rows or labels.",
middleware: [workspaceAccess.fromQuery()] as const,
request: { query: assignedTasksQuery },
responses: {
200: jsonResponse("Open tasks assigned to the caller", assignedTasksSchema),
- 400: errorResponse("Workspace ID could not be determined"),
+ 400: errorResponse("Invalid workspace ID or query parameters"),
403: errorResponse("No access to the workspace"),
},
});
@@ -794,8 +794,15 @@ const task = apiRouter<BaseVariables & { workspaceId: string }>()
})
// Registered ahead of the `/{id}` routes, which would otherwise claim it.
.openapi(listAssignedTasksRoute, async (c) => {
- const { workspaceId } = c.req.valid("query");
- return c.json(await getAssignedTasks(workspaceId, c.get("userId")), 200);
+ const { workspaceId, countOnly } = c.req.valid("query");
+ return c.json(
+ await getAssignedTasks(
+ workspaceId,
+ c.get("userId"),
+ countOnly === "true",
+ ),
+ 200,
+ );
})
.openapi(listTasksRoute, async (c) => {
const { projectId } = c.req.valid("param");
diff --git a/apps/api/src/task/schema.ts b/apps/api/src/task/schema.ts
index 3307b6673..b8cfb3649 100644
--- a/apps/api/src/task/schema.ts
+++ b/apps/api/src/task/schema.ts
@@ -29,7 +29,13 @@ export const ticketIdQuery = z.object({
export const projectIdParam = z.object({ projectId: z.string() });
-export const assignedTasksQuery = z.object({ workspaceId: z.string().min(1) });
+export const assignedTasksQuery = z.object({
+ workspaceId: z.string().min(1),
+ countOnly: z.enum(["true", "false"]).optional().openapi({
+ description:
+ "Return only the total, with an empty tasks array, without loading task rows or labels.",
+ }),
+});
const priority = z.enum(VALID_PRIORITIES);
diff --git a/apps/api/vitest.config.ts b/apps/api/vitest.config.ts
index fc86e73d1..d9bcfb3f9 100644
--- a/apps/api/vitest.config.ts
+++ b/apps/api/vitest.config.ts
@@ -3,7 +3,7 @@ import { defineConfig } from "vite-plus";
export default defineConfig({
test: {
environment: "node",
- include: ["../../tests/api/**/*.test.ts"],
+ include: ["../../tests/api/**/*.test.ts", "src/**/*.test.ts"],
coverage: {
enabled: false,
provider: "v8",
diff --git a/apps/docs/openapi.json b/apps/docs/openapi.json
index 079ffe41d..e95f82d02 100644
--- a/apps/docs/openapi.json
+++ b/apps/docs/openapi.json
@@ -8532,7 +8532,7 @@
"Tasks"
],
"summary": "List my assigned tasks",
- "description": "Get the open tasks assigned to the caller across a workspace's active projects. Completed and archived tasks are excluded. Ordered by due date (undated last), then priority. At most 100 tasks are returned; total counts all of them.",
+ "description": "Get the open tasks assigned to the caller across a workspace's active projects. Completed and archived tasks are excluded. Ordered by due date (undated last), then priority. At most 100 tasks are returned; total counts all of them. Set countOnly=true to return just that total without loading task rows or labels.",
"parameters": [
{
"schema": {
@@ -8542,6 +8542,20 @@
"required": true,
"name": "workspaceId",
"in": "query"
+ },
+ {
+ "schema": {
+ "type": "string",
+ "enum": [
+ "true",
+ "false"
+ ],
+ "description": "Return only the total, with an empty tasks array, without loading task rows or labels."
+ },
+ "required": false,
+ "description": "Return only the total, with an empty tasks array, without loading task rows or labels.",
+ "name": "countOnly",
+ "in": "query"
}
],
"responses": {
@@ -8556,7 +8570,7 @@
}
},
"400": {
- "description": "Workspace ID could not be determined",
+ "description": "Invalid workspace ID or query parameters",
"content": {
"text/plain": {
"schema": {
diff --git a/apps/web/src/components/inbox/inbox-list.tsx b/apps/web/src/components/inbox/inbox-list.tsx
index 65506f26b..a3d5144d9 100644
--- a/apps/web/src/components/inbox/inbox-list.tsx
+++ b/apps/web/src/components/inbox/inbox-list.tsx
@@ -13,6 +13,7 @@ import {
import { Button } from "@/components/ui/button";
import useClearNotifications from "@/hooks/mutations/notification/use-clear-notifications";
import useMarkAllNotificationsAsRead from "@/hooks/mutations/notification/use-mark-all-notifications-as-read";
+import { useLocalDay } from "@/hooks/use-local-day";
import { cn } from "@/lib/cn";
import type { Notification } from "@/types/notification";
import {
@@ -36,6 +37,7 @@ export function InboxList({
onSelect,
}: InboxListProps) {
const { t } = useTranslation();
+ const day = useLocalDay();
const [filter, setFilter] = useState<InboxFilter>("all");
const [showClearDialog, setShowClearDialog] = useState(false);
const { mutate: markAllAsRead } = useMarkAllNotificationsAsRead(workspaceId);
@@ -45,8 +47,12 @@ export function InboxList({
(notification) => !notification.isRead,
).length;
const { today, earlier } = useMemo(
- () => groupNotifications(filterNotifications(notifications, filter)),
- [notifications, filter],
+ () =>
+ groupNotifications(
+ filterNotifications(notifications, filter),
+ new Date(day),
+ ),
+ [notifications, filter, day],
);
const filters: Array<{ value: InboxFilter; label: string; count?: number }> =
diff --git a/apps/web/src/components/nav-main.tsx b/apps/web/src/components/nav-main.tsx
index 8325f89f9..154dbb530 100644
--- a/apps/web/src/components/nav-main.tsx
+++ b/apps/web/src/components/nav-main.tsx
@@ -40,7 +40,7 @@ export function NavMain() {
});
const { data: invitations = [] } = usePendingInvitations();
const { data: notifications = [] } = useGetNotifications(workspace?.id);
- const { data: assignedTasks } = useGetAssignedTasks(workspace?.id);
+ const { data: assignedTasks } = useGetAssignedTasks(workspace?.id, true);
const inboxUrl = workspace
? `/dashboard/workspace/${workspace.id}/inbox`
diff --git a/apps/web/src/fetchers/task/get-assigned-tasks.ts b/apps/web/src/fetchers/task/get-assigned-tasks.ts
index 106db60ae..5d15481c5 100644
--- a/apps/web/src/fetchers/task/get-assigned-tasks.ts
+++ b/apps/web/src/fetchers/task/get-assigned-tasks.ts
@@ -9,8 +9,10 @@ export type AssignedTasks = InferResponseType<
export type AssignedTask = AssignedTasks["tasks"][number];
-async function getAssignedTasks(workspaceId: string) {
- const response = await client.task.assigned.$get({ query: { workspaceId } });
+async function getAssignedTasks(workspaceId: string, countOnly = false) {
+ const response = await client.task.assigned.$get({
+ query: { workspaceId, countOnly: countOnly ? "true" : "false" },
+ });
if (!response.ok) {
throw new HttpError(response.status, await response.text());
diff --git a/apps/web/src/hooks/queries/personal-work-refresh.test.tsx b/apps/web/src/hooks/queries/personal-work-refresh.test.tsx
index 44985055e..d666aae86 100644
--- a/apps/web/src/hooks/queries/personal-work-refresh.test.tsx
+++ b/apps/web/src/hooks/queries/personal-work-refresh.test.tsx
@@ -3,7 +3,7 @@ import {
QueryClientProvider,
focusManager,
} from "@tanstack/react-query";
-import { act, cleanup, renderHook } from "@testing-library/react";
+import { act, cleanup, renderHook, waitFor } from "@testing-library/react";
import type { PropsWithChildren } from "react";
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
import useGetWorkspaceActivities from "./activity/use-get-workspace-activities";
@@ -40,6 +40,35 @@ afterEach(() => {
});
describe("personal work refresh", () => {
+ it("keeps sidebar counts separate from the full assigned-task cache", async () => {
+ mocks.assigned.mockImplementation(async (_workspaceId, countOnly) => ({
+ tasks: countOnly ? [] : [{ id: "task", title: "Assigned task" }],
+ total: 101,
+ }));
+ const client = new QueryClient({
+ defaultOptions: { queries: { retry: false } },
+ });
+ const wrapper = ({ children }: PropsWithChildren) => (
+ <QueryClientProvider client={client}>{children}</QueryClientProvider>
+ );
+ const { result } = renderHook(
+ () => ({
+ list: useGetAssignedTasks("workspace").data,
+ count: useGetAssignedTasks("workspace", true).data,
+ }),
+ { wrapper },
+ );
+ await waitFor(() => {
+ expect(result.current.list?.tasks).toEqual([
+ { id: "task", title: "Assigned task" },
+ ]);
+ expect(result.current.count).toEqual({ tasks: [], total: 101 });
+ });
+ expect(mocks.assigned).toHaveBeenCalledWith("workspace", false);
+ expect(mocks.assigned).toHaveBeenCalledWith("workspace", true);
+ client.clear();
+ });
+
it("refreshes remote edits and comments without a project socket or notification", async () => {
vi.useFakeTimers();
focusManager.setFocused(true);
diff --git a/apps/web/src/hooks/queries/task/use-get-assigned-tasks.ts b/apps/web/src/hooks/queries/task/use-get-assigned-tasks.ts
index a75ee9b99..9b4cc42c4 100644
--- a/apps/web/src/hooks/queries/task/use-get-assigned-tasks.ts
+++ b/apps/web/src/hooks/queries/task/use-get-assigned-tasks.ts
@@ -1,10 +1,13 @@
import { useQuery } from "@tanstack/react-query";
import getAssignedTasks from "@/fetchers/task/get-assigned-tasks";
-function useGetAssignedTasks(workspaceId: string | undefined) {
+function useGetAssignedTasks(
+ workspaceId: string | undefined,
+ countOnly = false,
+) {
return useQuery({
- queryKey: ["assigned-tasks", workspaceId],
- queryFn: () => getAssignedTasks(workspaceId ?? ""),
+ queryKey: ["assigned-tasks", workspaceId, { countOnly }],
+ queryFn: () => getAssignedTasks(workspaceId ?? "", countOnly),
enabled: Boolean(workspaceId),
// The app default skips refetching on mount; these lists go stale while
// the user works elsewhere.
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/index.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/index.tsx
index 08698759c..73eba71d9 100644
--- a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/index.tsx
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/index.tsx
@@ -74,6 +74,15 @@ function RouteComponent() {
workspaceId={workspaceId}
/>
+ {assigned && assigned.total > assigned.tasks.length && (
+ <p className="text-muted-foreground text-xs">
+ {t("workspace:home.week.truncated", {
+ shown: assigned.tasks.length,
+ total: assigned.total,
+ })}
+ </p>
+ )}
+
<div className="grid gap-10 lg:grid-cols-[minmax(0,1fr)_20rem]">
<div className="flex min-w-0 flex-col gap-9">
<UpNext
diff --git a/i18n/az-AZ.json b/i18n/az-AZ.json
index 56f2200a3..2eb5ccae9 100644
--- a/i18n/az-AZ.json
+++ b/i18n/az-AZ.json
@@ -2752,7 +2752,8 @@
},
"week": {
"more_one": "+{{count}} more",
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/de-DE.json b/i18n/de-DE.json
index 34727b882..460f01483 100644
--- a/i18n/de-DE.json
+++ b/i18n/de-DE.json
@@ -2752,7 +2752,8 @@
},
"week": {
"more_one": "+{{count}} more",
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/el-GR.json b/i18n/el-GR.json
index e2ecc3f67..5c47ef85a 100644
--- a/i18n/el-GR.json
+++ b/i18n/el-GR.json
@@ -2752,7 +2752,8 @@
},
"week": {
"more_one": "+{{count}} more",
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/en-US.json b/i18n/en-US.json
index a8c6905c1..c1a66c8c1 100644
--- a/i18n/en-US.json
+++ b/i18n/en-US.json
@@ -2731,6 +2731,7 @@
},
"newTask": "New task",
"week": {
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks.",
"more_one": "+{{count}} more",
"more_other": "+{{count}} more"
},
diff --git a/i18n/es-ES.json b/i18n/es-ES.json
index 1b0e4384f..7f723f448 100644
--- a/i18n/es-ES.json
+++ b/i18n/es-ES.json
@@ -2768,7 +2768,8 @@
"week": {
"more_many": "+{{count}} more",
"more_one": "+{{count}} more",
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/fr-FR.json b/i18n/fr-FR.json
index be6092126..e614290c0 100644
--- a/i18n/fr-FR.json
+++ b/i18n/fr-FR.json
@@ -2768,7 +2768,8 @@
"week": {
"more_many": "+{{count}} more",
"more_one": "+{{count}} more",
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/hi-IN.json b/i18n/hi-IN.json
index 2624fd59f..cf3a8bd7d 100644
--- a/i18n/hi-IN.json
+++ b/i18n/hi-IN.json
@@ -2752,7 +2752,8 @@
},
"week": {
"more_one": "+{{count}} more",
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/id-ID.json b/i18n/id-ID.json
index 7ff0244f9..a9e7af9e2 100644
--- a/i18n/id-ID.json
+++ b/i18n/id-ID.json
@@ -2736,7 +2736,8 @@
"viewAll": "View all"
},
"week": {
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/it-IT.json b/i18n/it-IT.json
index 2721e4ae2..ecf33bac0 100644
--- a/i18n/it-IT.json
+++ b/i18n/it-IT.json
@@ -2768,7 +2768,8 @@
"week": {
"more_many": "+{{count}} more",
"more_one": "+{{count}} more",
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/ja-JP.json b/i18n/ja-JP.json
index 7e1ab96d5..9c66b31e6 100644
--- a/i18n/ja-JP.json
+++ b/i18n/ja-JP.json
@@ -2736,7 +2736,8 @@
"viewAll": "View all"
},
"week": {
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/ko-KR.json b/i18n/ko-KR.json
index 459f498af..d90c7ea7f 100644
--- a/i18n/ko-KR.json
+++ b/i18n/ko-KR.json
@@ -2736,7 +2736,8 @@
"viewAll": "View all"
},
"week": {
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/mk-MK.json b/i18n/mk-MK.json
index a76f4a984..98f23450d 100644
--- a/i18n/mk-MK.json
+++ b/i18n/mk-MK.json
@@ -2752,7 +2752,8 @@
},
"week": {
"more_one": "+{{count}} more",
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/nl-NL.json b/i18n/nl-NL.json
index 1b312a558..01f1aaa9c 100644
--- a/i18n/nl-NL.json
+++ b/i18n/nl-NL.json
@@ -2752,7 +2752,8 @@
},
"week": {
"more_one": "+{{count}} more",
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/pl-PL.json b/i18n/pl-PL.json
index 5638e0e60..34b5d4bff 100644
--- a/i18n/pl-PL.json
+++ b/i18n/pl-PL.json
@@ -713,7 +713,8 @@
"more_few": "+{{count}} more",
"more_many": "+{{count}} more",
"more_one": "+{{count}} more",
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/pt-BR.json b/i18n/pt-BR.json
index dc015ba4d..c0976e92d 100644
--- a/i18n/pt-BR.json
+++ b/i18n/pt-BR.json
@@ -2768,7 +2768,8 @@
"week": {
"more_many": "+{{count}} more",
"more_one": "+{{count}} more",
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/ru-RU.json b/i18n/ru-RU.json
index 209b03fcb..422ac88c3 100644
--- a/i18n/ru-RU.json
+++ b/i18n/ru-RU.json
@@ -2840,7 +2840,8 @@
"more_few": "+{{count}} more",
"more_many": "+{{count}} more",
"more_one": "+{{count}} more",
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/schema.json b/i18n/schema.json
index f5ad831c8..724373709 100644
--- a/i18n/schema.json
+++ b/i18n/schema.json
@@ -11238,6 +11238,9 @@
"type": "object",
"additionalProperties": false,
"properties": {
+ "truncated": {
+ "type": "string"
+ },
"more_one": {
"type": "string"
},
@@ -11257,7 +11260,7 @@
"type": "string"
}
},
- "required": []
+ "required": ["truncated"]
},
"upNext": {
"type": "object",
diff --git a/i18n/tr-TR.json b/i18n/tr-TR.json
index 0680121c8..67dc8cd61 100644
--- a/i18n/tr-TR.json
+++ b/i18n/tr-TR.json
@@ -2752,7 +2752,8 @@
},
"week": {
"more_one": "+{{count}} more",
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/uk-UA.json b/i18n/uk-UA.json
index d214dc4fc..97754221c 100644
--- a/i18n/uk-UA.json
+++ b/i18n/uk-UA.json
@@ -2784,7 +2784,8 @@
"more_few": "+{{count}} more",
"more_many": "+{{count}} more",
"more_one": "+{{count}} more",
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/vi-VN.json b/i18n/vi-VN.json
index eddc5de62..220e11fb4 100644
--- a/i18n/vi-VN.json
+++ b/i18n/vi-VN.json
@@ -2736,7 +2736,8 @@
"viewAll": "View all"
},
"week": {
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/i18n/zh-CN.json b/i18n/zh-CN.json
index 99d9a46cd..e4ddd863b 100644
--- a/i18n/zh-CN.json
+++ b/i18n/zh-CN.json
@@ -2736,7 +2736,8 @@
"viewAll": "View all"
},
"week": {
- "more_other": "+{{count}} more"
+ "more_other": "+{{count}} more",
+ "truncated": "The week preview includes only the first {{shown}} of {{total}} assigned tasks."
}
},
"myTasks": {
diff --git a/tests/api-integration/assigned-tasks.test.ts b/tests/api-integration/assigned-tasks.test.ts
index fdf1c9edb..f9da47e50 100644
--- a/tests/api-integration/assigned-tasks.test.ts
+++ b/tests/api-integration/assigned-tasks.test.ts
@@ -139,6 +139,11 @@ describe("API integration: assigned tasks", () => {
const body = (await response.json()) as AssignedTasksResponse;
expect(body.total).toBe(3);
+ const countResponse = await app.request(
+ `/api/task/assigned?workspaceId=${member.workspace.id}&countOnly=true`,
+ );
+ expect(countResponse.status).toBe(200);
+ expect(await countResponse.json()).toEqual({ tasks: [], total: 3 });
expect(body.tasks.map((task) => task.id)).toEqual([
soon.id,
later.id,
@@ -192,9 +197,11 @@ describe("API integration: assigned tasks", () => {
mockAuthenticatedSession(outsider.user);
const { app } = createApp();
- const response = await app.request(
- `/api/task/assigned?workspaceId=${member.workspace.id}`,
- );
- expect(response.status).toBe(403);
+ for (const countOnly of ["false", "true"]) {
+ const response = await app.request(
+ `/api/task/assigned?workspaceId=${member.workspace.id}&countOnly=${countOnly}`,
+ );
+ expect(response.status).toBe(403);
+ }
});
});