Profile accounts: invites, any-Google sign-in, claiming People, visibility, Discord
Migration 076 adds a member role below viewer (the site and its own profile, never the admin: /api/admin now needs viewer), invites, person claims, a Discord link on accounts and people.hide_* switches. Public reads of people go through v_people_public, which nulls hidden fields, and the views that read people are rebuilt over it. Admins invite an email from Data -> Profile accounts (link shown once, emailed on request). The invitee sets a password or signs in with any Google account under that email, asks to claim their People record, and once approved edits it and chooses what shows at /account. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0cc2a3f721
commit
e4c7e165d1
34 changed files with 2483 additions and 74 deletions
|
|
@ -302,7 +302,7 @@ function awardMeta(site, db, id, meta) {
|
|||
}
|
||||
|
||||
function personMeta(site, db, id, meta) {
|
||||
const row = db.prepare(`SELECT * FROM people WHERE id = ? AND is_published = 1`).get(id);
|
||||
const row = db.prepare(`SELECT * FROM v_people_public WHERE id = ? AND is_published = 1`).get(id);
|
||||
if (!row) return notFound(meta);
|
||||
return {
|
||||
...meta,
|
||||
|
|
@ -332,7 +332,7 @@ function blogMeta(site, db, id, meta) {
|
|||
.prepare(
|
||||
`SELECT p.display_name AS name
|
||||
FROM blog_post_authors a
|
||||
JOIN people p ON p.id = a.person_id AND p.is_published = 1
|
||||
JOIN v_people_public p ON p.id = a.person_id AND p.is_published = 1
|
||||
WHERE a.post_id = ? ORDER BY a.sort_order`,
|
||||
)
|
||||
.all(id)
|
||||
|
|
@ -364,6 +364,10 @@ function blogMeta(site, db, id, meta) {
|
|||
};
|
||||
}
|
||||
|
||||
/* The profile account pages and their titles (src/pages/SignIn.tsx,
|
||||
Account.tsx, AccountWelcome.tsx say the same). */
|
||||
const ACCOUNT_PAGES = { "/sign-in": "Sign in", "/account": "Your profile", "/account/welcome": "Welcome" };
|
||||
|
||||
/* The metadata for one request path, for this visitor (the signed-in
|
||||
user or null, who decides whether a hidden page is there). */
|
||||
export function metaFor(db, rawPath, user = null) {
|
||||
|
|
@ -402,6 +406,10 @@ export function metaFor(db, rawPath, user = null) {
|
|||
|
||||
if (/^\/admin(\/|$)/.test(pathname)) return { ...meta, title: `Admin | ${site.title}`, noindex: true };
|
||||
|
||||
// A profile account's pages (076): there for anyone, about no one
|
||||
// in particular, so never indexed or in the sitemap.
|
||||
if (ACCOUNT_PAGES[pathname]) return { ...meta, title: titled(site, ACCOUNT_PAGES[pathname]), noindex: true };
|
||||
|
||||
const page = site.pages?.[pathname];
|
||||
if (page && hiddenFrom(db, user, pathname)) return notFound(meta);
|
||||
if (page) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue