Remove the all workspaces filter and make it so someone always as to be in a…

merged…
osebo37d ago

Remove the all workspaces filter and make it so someone always as to be in a workspace

3 repliesoldestnewest
Osebotfable-5-137d ago

Reading this as: the home page should never show "all workspaces" (or the "General (no workspace)" pseudo-workspace); you're always looking at one workspace, and threads always belong to one.

Plan:

  1. Header dropdown (components/header-workspace.tsx): drop the "All workspaces" and "General (no workspace)" options; it only lists real workspaces. Picking one is remembered in a workspace cookie so other pages (thread pages, /workspaces) show the same selection.
  2. Home page (app/page.tsx): / without a valid ?workspace= redirects to /?workspace=<remembered | first workspace you're a member of | first workspace> (keeping ?q/?status). No workspaces exist at all → an empty state linking to /workspaces.
  3. Thread composer (components/thread-composer.tsx): remove the "No workspace" option; if you can't post anywhere, show a note instead of the form. POST /api/threads requires workspaceId; GET /api/threads drops the general sentinel.
  4. Keep the DB column nullable (no migration): old general threads stay reachable by URL, they just no longer appear in the home list.

Will typecheck and screenshot a mockup of the header dropdown.

Osebotfable-5-137d agothreadide@060ccf9

Done, pushed to thread/1ebcdee1 (060ccf9). Typecheck passes.

What changed

  • Header dropdown (components/header-workspace.tsx): only real workspaces are listed; "All workspaces" and "General (no workspace)" are gone. Your pick is stored in a workspace cookie, so thread pages and /workspaces show the same selection.
  • Home page (app/page.tsx): / without a valid ?workspace= redirects to /?workspace=<last picked | first workspace you're a member of | first workspace>, keeping ?q/?status. If the site has no workspaces at all, you get a note linking to /workspaces. If you can read the current workspace but can't post anywhere, a note replaces the composer instead of an empty picker.
  • Thread composer (components/thread-composer.tsx): the "No workspace" option is removed; POST /api/threads now requires workspaceId, and GET /api/threads drops the general sentinel.
  • Thread-list empty copy is now "No threads in <workspace> yet. Start the first one above." (the workspace is the page's context, not a filter).
  • Small hardening on the way: workspace-id validation uses Object.hasOwn instead of in, so ?workspace=constructor (or a crafted cookie) can't reach Postgres as a non-uuid.

Judgement calls, shout if you want them different

  1. I removed the General (no workspace) pseudo-workspace too, since "always in a workspace" rules it out. The DB column stays nullable (no migration): existing general threads still open by URL, they just don't appear in any list. If you'd rather keep "General" as a selectable entry, it's a one-line option plus the old sentinel.
  2. Every row on the home list still prints "workspace · repos" in its meta line, which is now identical on every row. I left it alone; happy to hide it on the home page if you want.

No screenshot: the app can't run in the sandbox and the visible change is three dropdown options disappearing plus two text notes.

Osebot37d ago

Merged threadide #119 by @osebo (merge, 2b66460).