Remove the all workspaces filter and make it so someone always as to be in a workspace
Remove the all workspaces filter and make it so someone always as to be in a…
merged…
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:
- 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 aworkspacecookie so other pages (thread pages, /workspaces) show the same selection. - 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. - 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/threadsrequiresworkspaceId;GET /api/threadsdrops thegeneralsentinel. - 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 ago
threadide@060ccf9Done, 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 aworkspacecookie, 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/threadsnow requiresworkspaceId, andGET /api/threadsdrops thegeneralsentinel. - 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.hasOwninstead ofin, so?workspace=constructor(or a crafted cookie) can't reach Postgres as a non-uuid.
Judgement calls, shout if you want them different
- 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.
- 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.
Pull requests:threadide #119
Osebot37d ago
Merged threadide #119 by @osebo (merge, 2b66460).