-
Notifications
You must be signed in to change notification settings - Fork 14
feat(tasks): add toggle for internal tasks in sidebar for staff #1952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,6 +24,7 @@ const taskKeys = { | |||||||
| repository?: string; | ||||||||
| createdBy?: number; | ||||||||
| originProduct?: string; | ||||||||
| internal?: boolean; | ||||||||
| }) => [...taskKeys.lists(), filters] as const, | ||||||||
| details: () => [...taskKeys.all, "detail"] as const, | ||||||||
| detail: (id: string) => [...taskKeys.details(), id] as const, | ||||||||
|
|
@@ -32,16 +33,19 @@ const taskKeys = { | |||||||
| export function useTasks(filters?: { | ||||||||
| repository?: string; | ||||||||
| showAllUsers?: boolean; | ||||||||
| showInternal?: boolean; | ||||||||
| }) { | ||||||||
| const { data: currentUser } = useMeQuery(); | ||||||||
| const createdBy = filters?.showAllUsers ? undefined : currentUser?.id; | ||||||||
| const internal = filters?.showInternal ? true : undefined; | ||||||||
|
Comment on lines
39
to
+40
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: apps/code/src/renderer/features/tasks/hooks/useTasks.ts
Line: 39-40
Comment:
**`createdBy` not cleared when fetching internal tasks**
When `showInternal` is `true` but `showAllUsers` is `false`, `createdBy` is still set to `currentUser?.id`. Internal tasks are created by the agent service (not the current user), so the backend receives both `internal=true` and `created_by=<userId>` — and applying both filters together will likely return an empty result set. `createdBy` should be `undefined` whenever `showInternal` is `true`.
```suggestion
const createdBy = filters?.showAllUsers || filters?.showInternal ? undefined : currentUser?.id;
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||||
|
|
||||||||
| return useAuthenticatedQuery( | ||||||||
| taskKeys.list({ repository: filters?.repository, createdBy }), | ||||||||
| taskKeys.list({ repository: filters?.repository, createdBy, internal }), | ||||||||
| (client) => | ||||||||
| client.getTasks({ | ||||||||
| repository: filters?.repository, | ||||||||
| createdBy, | ||||||||
| internal, | ||||||||
| }) as unknown as Promise<Task[]>, | ||||||||
| { enabled: !!currentUser?.id, refetchInterval: TASK_LIST_POLL_INTERVAL_MS }, | ||||||||
| ); | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing "Show all users" toggle is gated by
import.meta.env.DEV, but this new toggle usesisStaff. Staff users in production builds will see "Task visibility" in the filter menu; however, the backend only honoursinternal=truewhensettings.DEBUGis enabled, so the toggle silently does nothing in production. Consider aligning the guard with the existing pattern (import.meta.env.DEV) or adding animport.meta.env.DEVcheck alongsideisStaffto avoid showing a non-functional control to production staff.Prompt To Fix With AI