This repository was archived by the owner on Aug 6, 2026. It is now read-only.
Repository navigation
feat(tasks): add toggle for internal tasks in sidebar for staff #1952
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }, | ||||||||
| ); | ||||||||
|
|
||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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