mirror of
https://github.com/traberph/short.git
synced 2026-11-22 22:55:12 +00:00
- 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>
18 lines
780 B
TypeScript
18 lines
780 B
TypeScript
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 === "" },
|
|
];
|
|
}
|