Give every task a bot: drop shared workspace tasks
A workspace task with no bot was seen by every bot working there. Now a task can't be saved without a bot, a worker reaches only its own (the workspace admin and the coordinator still reach all), the workspace page picks who has a new task, and a bot leaving a workspace or deleted passes its tasks there to the workspace's admin bot, else the coordinator (also at boot for rows without a bot). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -6,17 +6,17 @@ type Params = {
|
||||
};
|
||||
|
||||
/**
|
||||
* Where a task lives and who has it. A bot's own list is `bot_id` alone; a
|
||||
* workspace's task has `workspace_id`, plus `bot_id` when a bot there has
|
||||
* it (none: shared, not yet anyone's). Checked in the helpers rather than
|
||||
* the schema.
|
||||
* Where a task lives and who has it. Every task belongs to a bot: a bot's
|
||||
* own list is `bot_id` alone, a workspace's task has `workspace_id` plus
|
||||
* the `bot_id` that has it there. Checked in the helpers rather than the
|
||||
* schema.
|
||||
*/
|
||||
export default function taskScopeValues({ bot_id, workspace_id }: Params) {
|
||||
const bot = bot_id ? Number(bot_id) : null;
|
||||
const workspace = workspace_id ? Number(workspace_id) : null;
|
||||
|
||||
if (!bot && !workspace) {
|
||||
throw new AppError(`Say which bot or workspace the task is for.`);
|
||||
if (!bot) {
|
||||
throw new AppError(`Say which bot has the task.`);
|
||||
}
|
||||
|
||||
return { bot_id: bot, workspace_id: workspace };
|
||||
|
||||
Reference in New Issue
Block a user