A task running in a workspace shows "Working on a task in <name> workspace", so the bot's own chat and the main rail say where the work is. Outside a workspace it stays "Working on a task". Co-Authored-By: Claude Opus 5.5 <[email protected]>
21 lines
609 B
TypeScript
21 lines
609 B
TypeScript
import BunSQLite from "@moduletrace/bun-sqlite";
|
|
|
|
type Params = {
|
|
workspace_id?: number | string | null;
|
|
};
|
|
|
|
/**
|
|
* A workspace's name as it is, without an access check, for copy the
|
|
* caller already decided to show. Null when there's none.
|
|
*/
|
|
export default async function grabWorkspaceName({ workspace_id }: Params): Promise<string | null> {
|
|
if (!workspace_id) return null;
|
|
|
|
const res = await BunSQLite.sql<{ name: string | null }>({
|
|
sql: `SELECT name FROM workspaces WHERE id = ? LIMIT 1`,
|
|
values: [Number(workspace_id)],
|
|
});
|
|
|
|
return res.payload?.[0]?.name || null;
|
|
}
|