mirror of
https://github.com/traberph/short.git
synced 2026-11-22 22:55:12 +00:00
Separate admins' own content from managing other users
- Short links, Link pages and Overview now show only the admin's own namespace and root; other users' content moved to Administration - Administration lists users with their link/page/click counts; each opens /~/admin/users/<name> with that user's pages and links and lets admins create content in their namespace - other users' pages open under /~/admin/users/<name>/…, keep the Administration section active and link back to the user - one PageTable component for all lists, so search and the namespace filter (All / mine / Root, admins only) behave the same everywhere - the create dialog offers admins only their own namespace and root; the existing-link picker groups links by namespace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import type { Me, PageSummary } from "../../shared/api-types.js";
|
||||
import type { NamespaceOption } from "../components/PageTable.js";
|
||||
|
||||
// "Your" content: your own namespace, plus root for admins. Other users' content is managed under Administration.
|
||||
export function isMine(page: Pick<PageSummary, "namespace">, me: Me): boolean {
|
||||
return page.namespace === me.username || (me.isAdmin && page.namespace === "");
|
||||
}
|
||||
|
||||
// Namespace filter for admins, who see both their own and root content.
|
||||
export function myNamespaceOptions(me: Me): NamespaceOption[] | undefined {
|
||||
if (!me.isAdmin) return undefined;
|
||||
return [
|
||||
{ label: "All", match: () => true },
|
||||
{ label: `/${me.username}/`, match: (ns) => ns === me.username },
|
||||
{ label: "Root /", match: (ns) => ns === "" },
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user