Scope workspace tasks to the bot that has them
A workspace's task now carries the bot that has it there (bot_id with workspace_id), or none while it's shared. A bot reaches its own list and, in its workspaces, its own tasks plus the shared ones; a workspace admin every task there. Bots create workspace tasks for themselves by default, take a shared one by starting it, and hand-overs record the new bot. Removing or deleting a bot makes its workspace tasks shared again. The conversation's Tasks modal shows that bot's tasks in the workspace. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -24,10 +24,21 @@ type Params = {
|
||||
*/
|
||||
admin_workspace_ids?: number[];
|
||||
/**
|
||||
* Only one collection.
|
||||
* Only the tasks this bot has (anywhere, unless narrowed).
|
||||
*/
|
||||
only_bot_id?: number | string | null;
|
||||
/**
|
||||
* With `only_bot_id`: also the shared ones nobody has yet.
|
||||
*/
|
||||
with_unassigned?: boolean;
|
||||
/**
|
||||
* Only one workspace's tasks.
|
||||
*/
|
||||
only_workspace_id?: number | string | null;
|
||||
/**
|
||||
* Only bots' own lists, outside any workspace.
|
||||
*/
|
||||
own_list?: boolean;
|
||||
/**
|
||||
* Only these statuses; none for every one.
|
||||
*/
|
||||
@@ -50,7 +61,9 @@ export default async function grabTasks({
|
||||
is_coordinator,
|
||||
admin_workspace_ids,
|
||||
only_bot_id,
|
||||
with_unassigned,
|
||||
only_workspace_id,
|
||||
own_list,
|
||||
statuses,
|
||||
open_only,
|
||||
limit,
|
||||
@@ -69,10 +82,14 @@ export default async function grabTasks({
|
||||
}
|
||||
|
||||
if (only_bot_id) {
|
||||
where.push(`t.bot_id = ?`);
|
||||
where.push(with_unassigned ? `(t.bot_id = ? OR t.bot_id IS NULL)` : `t.bot_id = ?`);
|
||||
values.push(Number(only_bot_id));
|
||||
}
|
||||
|
||||
if (own_list) {
|
||||
where.push(`t.workspace_id IS NULL`);
|
||||
}
|
||||
|
||||
if (only_workspace_id) {
|
||||
where.push(`t.workspace_id = ?`);
|
||||
values.push(Number(only_workspace_id));
|
||||
|
||||
Reference in New Issue
Block a user