gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit71b6934371b69343gitoria#23: the sidebar's Repositories link was a 404 after any in-page navigation (static menu re-evaluated publicUrl in the browser); the menu is an instance property now; gate taps it after a tab, folder, filemre71b69343/components/settings.hl

3.3 KB

  1. // components/settings.hl — THE SETTINGS of a repo (gitoria#18): `/settings` on <slug>.<domain>. For now one section,
  2. // "Tickets": connect the repo to a tickets.worldapi.org project (the owner clicks "Tickets: connect", tickets asks which
  3. // project, and brings them back — lib/api.hl /settings/connect and /settings/connected; lib/tickets.hl). Anyone sees
  4. // whether the repo is connected; only the owner sees the buttons. Rendered on the server from the request's host.
  5. // (The main branch is switched on the code page.)
  6. parent './repo.hl'
  7. import { siteName } from '../project.hl'
  8. import { slugOfHost } from '../lib/util.hl'
  9. import { userOfSession } from '../lib/users.hl'
  10. import { repoAt, ownsRepo, setTicketsConnection } from '../lib/repos.hl'
  11. import { pageTitle } from '../lib/repos-helpers.hl'
  12. import { ticketsUrl } from '../lib/tickets-helpers.hl'
  13. host = null
  14. session = null
  15. slug = slugOfHost(host)
  16. repo = repoAt(slug)
  17. hasRepo = repo != null
  18. isOwner = repo != null && ownsRepo(slug, session)
  19. connected = repo != null && repo.ticketsOn
  20. notConnected = repo != null && !repo.ticketsOn
  21. projectTitle = repo != null ? repo.ticketsTitle : ''
  22. projectHref = repo != null && repo.ticketsOn ? ticketsUrl + '/projects/' + repo.ticketsProject : ''
  23. connectNote = session != null && session.data != null && session.data.connectNote != null ? session.data.connectNote : ''
  24. hasConnectNote = connectNote != ''
  25. notOwnerHint = repo != null && !isOwner
  26. settingsError = ''
  27. forgetClass = repo != null && repo.ticketsOn ? 'quiet' : 'nomerge'
  28. __title = pageTitle(siteName, slug, 'Settings')
  29. View {
  30. repoPage {
  31. if (hasRepo) {
  32. repoSettings { id = "settings"
  33. section { id = "ticketsettings"
  34. h2 { "Tickets" }
  35. if (hasConnectNote) { p { id = "connectnote" class = "message" connectNote } }
  36. if (connected) {
  37. p { id = "connectedto" "Connected to the tickets project " a { id = "projectlink" href = projectHref projectTitle } "." }
  38. }
  39. if (notConnected) { p { id = "notconnected" class = "muted" "This repository is not connected to a tickets project yet." } }
  40. if (isOwner) {
  41. p {
  42. a { id = "connecttickets" class = "button" href = "/settings/connect" "Tickets: connect" }
  43. }
  44. button { id = "disconnecttickets" class = forgetClass type = "button" "Forget the connection" on click(e) { emit disconnect() } }
  45. p { class = "muted" "Connecting asks tickets which project (you must be its admin there). Tickets can also disconnect gitoria from its side." }
  46. }
  47. if (notOwnerHint) { p { id = "ownerhint" class = "muted" "Only the owner of this repository can connect it." } }
  48. p { id = "settingserror" class = "message" settingsError }
  49. }
  50. }
  51. }
  52. }
  53. }
  54. on disconnect() {
  55. settingsError = ''
  56. r = emit server gitoriaDisconnectTickets(slug)
  57. if (r == null || r.error != null) {
  58. settingsError = r != null ? r.error : 'could not disconnect'
  59. return null
  60. }
  61. connected = false
  62. notConnected = true
  63. forgetClass = 'nomerge'
  64. projectTitle = ''
  65. projectHref = ''
  66. }
  67. on server gitoriaDisconnectTickets(slugOf, session) {
  68. if (session == null || repoAt(slugOf) == null) { return { error = 'could not disconnect' } }
  69. if (userOfSession(session) == null || !ownsRepo(slugOf, session)) { return { error = 'only the owner can change this' } }
  70. r = setTicketsConnection(slugOf, '', '', '', '')
  71. if (r.error != null) { return { error = r.error } }
  72. return { ok = true }
  73. }

Branches

Latest commits

  • 71b69343gitoria#23: the sidebar's Repositories link was a 404 after any in-page navigation (static menu re-evaluated publicUrl in the browser); the menu is an instance property now; gate taps it after a tab, folder, filemre
  • 90b4f728gitoria#25: restore the homepage cache and the parsed-blocks cache (they store data under immutable keys, no HTML); the page key, the framework readme key and the textHash key stay removedmre
  • a487248cgitoria#25: remove every cache that hid the page build (page key, Markdown render key, homepage cache, parsed-blocks cache) and the gate that only tested themmre
  • 12f2f4fegitoria: re-vendor Hybriel set-day27b, a startup fault in on Error exits 1mre
  • c21c084egitoria: write the standby service out in full so the boot gate can read the main servicemre
  • e307d69agitoria: say what is per process during the hand-overmre
  • f0cbe6a6gitoria: standby service on port 45014 and a deploy that hands over through it without a gapmre
  • 727cd083gitoria#25: README: vendor notes for Hybriel c1b1010f and the page cachemre
  • 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