gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitf0e7ff8cf0e7ff8cdeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mref0e7ff8c/components/settings.hl

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

Branches

Latest commits

  • f0e7ff8cdeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
  • fe5f707cgitoria 010: report, mission, comment on why current = true staysmre
  • 9705ca86gitoria 010: gate: menu marker in the server HTMLmre
  • 8cff663agitoria 010: main-menu.hl from layouts 0bcc629 (route marker)mre
  • 359c79f7gitoria 010: re-vendor Hybriel master f9614007 (plugins whole, bin/ git-ignored)mre
  • 6bd7fb3cgitoria 009: theme re-copied from layouts 76f99f6 (menu marks the current page), current = true on the menu item, e2e marker checks, reportmre
  • 44de915cidentkit: refuse a taken ident port, cold-start deadline, abort on dead ident, clear no-code error (as notes)mre
  • 2bf5343egitoria 007: theme re-copied from layouts dbe3de7 (44 px taps), redundant tap overrides dropped, crumbs class, real-browser walk test, reportmre
  • 18843648deploy.sh: a gate without a 'passed,' line (check-theme) no longer ends the script silently (grep under pipefail) — print check-theme's summary, as layouts doesmre
  • e6dff0cbgitoria#23: report 005, STATUS, LOGmre
  • 7f992d62gitoria#23: phone first on the shared theme — brand, branch and pull links 44 px, readme code 14 px; gate block "phone first" (15 pages at 390 + the three dropdowns, fails 20 on old), dropdown-aware login/logout clicks, check-theme in GATESmre
  • a2a840a5gitoria#23 WIP (quota stop): theme from layouts, styles inherit it, shell on the theme's header/menus/sidebar, phone measurement script; gates not runmre
  • 12b665b0mission brief 005mre
  • b680c483Revert "gitoria#22: RepoTabs wrapping component for the repo tabs (active tab, no content for a missing repo)"mre
  • 4fda244fgitoria#22: RepoTabs wrapping component for the repo tabs (active tab, no content for a missing repo)mre
  • 0fd5e280mission brief 004mre
  • e1d425e7paths: projects moved into /media/STORAGE/projects/WorldAPI/mre
  • e59ff114deploy.sh: wait up to DEPLOY_URL_WAIT (120 s) for 200 after the restart, as the other apps (cold compile, hybriel#148)mre
  • bcafcceb003: compose cache volume + tmpfs /tmp, gate start waits 120 s, report/LOG/STATUSmre
  • bed3f2d5Re-vendor Hybriel to the shared static build 0f396652 (plugins; bin/ is git-ignored)mre