gitoria
All repositories: gitoria
3.3 KB
// components/settings.hl — THE SETTINGS of a repo (gitoria#18): `/settings` on <slug>.<domain>. For now one section,// "Tickets": connect the repo to a tickets.worldapi.org project (the owner clicks "Tickets: connect", tickets asks which// project, and brings them back — lib/api.hl /settings/connect and /settings/connected; lib/tickets.hl). Anyone sees// whether the repo is connected; only the owner sees the buttons. Rendered on the server from the request's host.// (The main branch is switched on the code page.)parent './repo.hl'import { siteName } from '../project.hl'import { slugOfHost } from '../lib/util.hl'import { userOfSession } from '../lib/users.hl'import { repoAt, ownsRepo, setTicketsConnection } from '../lib/repos.hl'import { pageTitle } from '../lib/repos-helpers.hl'import { ticketsUrl } from '../lib/tickets-helpers.hl'host = nullsession = nullslug = slugOfHost(host)repo = repoAt(slug)hasRepo = repo != nullisOwner = repo != null && ownsRepo(slug, session)connected = repo != null && repo.ticketsOnnotConnected = repo != null && !repo.ticketsOnprojectTitle = repo != null ? repo.ticketsTitle : ''projectHref = repo != null && repo.ticketsOn ? ticketsUrl + '/projects/' + repo.ticketsProject : ''connectNote = session != null && session.data != null && session.data.connectNote != null ? session.data.connectNote : ''hasConnectNote = connectNote != ''notOwnerHint = repo != null && !isOwnersettingsError = ''forgetClass = repo != null && repo.ticketsOn ? 'quiet' : 'nomerge'__title = pageTitle(siteName, slug, 'Settings')View {repoPage {if (hasRepo) {repoSettings { id = "settings"section { id = "ticketsettings"h2 { "Tickets" }if (hasConnectNote) { p { id = "connectnote" class = "message" connectNote } }if (connected) {p { id = "connectedto" "Connected to the tickets project " a { id = "projectlink" href = projectHref projectTitle } "." }}if (notConnected) { p { id = "notconnected" class = "muted" "This repository is not connected to a tickets project yet." } }if (isOwner) {p {a { id = "connecttickets" class = "button" href = "/settings/connect" "Tickets: connect" }}button { id = "disconnecttickets" class = forgetClass type = "button" "Forget the connection" on click(e) { emit disconnect() } }p { class = "muted" "Connecting asks tickets which project (you must be its admin there). Tickets can also disconnect gitoria from its side." }}if (notOwnerHint) { p { id = "ownerhint" class = "muted" "Only the owner of this repository can connect it." } }p { id = "settingserror" class = "message" settingsError }}}}}}on disconnect() {settingsError = ''r = emit server gitoriaDisconnectTickets(slug)if (r == null || r.error != null) {settingsError = r != null ? r.error : 'could not disconnect'return null}connected = falsenotConnected = trueforgetClass = 'nomerge'projectTitle = ''projectHref = ''}on server gitoriaDisconnectTickets(slugOf, session) {if (session == null || repoAt(slugOf) == null) { return { error = 'could not disconnect' } }if (userOfSession(session) == null || !ownsRepo(slugOf, session)) { return { error = 'only the owner can change this' } }r = setTicketsConnection(slugOf, '', '', '', '')if (r.error != null) { return { error = r.error } }return { ok = true }}
Branches
- f1-broken-json
- f2-api-bugs
- gp-gate-ports
- heap-revert
- hl25-records
- ident-chooser-selector
- mainmain branch
- p51-public-pr-reads
- records-1112
- s25-no-session-on-login-error
- v59
- w52-person-approval
- w52b-approval-followup
- w52c-header-phone
- w53-pulls-speed-pr
- w54-repo-rename-pr
- w55-rename-org
- w56-owner-members
- w62-pr-close
- w63-force-push
- w64-org-slash
Latest commits
- 61b72dedgitoria#25: re-vendor Hybriel master c1b1010f (W149 page cache), key the repo Readme page by slug and main commit, extend the readme-cache gatemre
- 5b0b4b9ereadme-cache gate: use the security gate's ports when no own ports are givenmre
- bc8f20d9gitoria#25: re-vendor Hybriel c09538bb with the W141 render cache, cache the homepage per commit, add the readme-cache gatemre
- 9feebbd3Re-vendor Hybriel to ded47c13 (W145: Firefox start script fix)mre
- 28ed41e5gitoria#24: one sign-in comes from hl:web batch 20, the /session/share workaround is gonemre
- 3b2669e4gs: drop the unbuildable legacy check, fix pwa fetchmre
- 2a2fdd77gs: C2 check before cookie experimentsmre
- 76e0587aWIP gs 2mre
- a80da7bdWIP gs: security gate for lazy sessions, g24 browser checksmre
- 23fb05d8re-vendor Hybriel aaa39e69 (hl:web batch 20: login emit and Sessions.mint, tab follows a login, signed-in session cookie wins among duplicates and is re-issued with the Domain, W85 faster render, lazy sessions)mre
- a0727ca3ident#31: the selector's sign-in returns to the page the user started on (return attribute = the login callback with next), gate checkmre
- a06975f9gitoria: a gap between your name and Log out in the phone header (they touched); gate checks itmre
- 32ba9d59gitoria: leave the host-only cookie experiment out of the browser gate (gitoria#24 is a separate mission)mre
- 43ad2bcfgitoria header: the selector alone plus your name and Log out as before the theme missions; tests follow (WIP: host-only cookie experiment fails)mre
- ac2c4e3fident selector back in the header (creator 2026-10-24): selector top right signed in and out on phone and desktop, no second Log in button, new gate checks (WIP: gates not re-run after the last edits)mre
- b279f536theme: sync from layouts 4994037 (list rows stack, td word-keep, heading code, edited tap target)mre
- 2b01515ctests/ticketskit: a failed start kills the tickets server (own process group); stop() kills the groupmre
- 109cfc5ctests/ticketskit: keep the rotated session cookie of the tickets login (tickets ST2 session rotation)mre
- 7eb6be27sessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
- b3911918reports/MG-mobile.md: 404 fixed, rebased gatesMG