gitoriaLog in with ident

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit3dc431083dc43108antcolony#40: mission references point to the moved missionsmre3dc43108/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 — project.hl /settings/connect and /settings/connected; 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 { repoAt, pageTitle, ownsRepo, setTicketsConnection } from '../repos.hl'
  10. import { slugOfHost, userOfSession } from '../users.hl'
  11. import { ticketsUrl } from '../tickets.hl'
  12. host = null
  13. session = null
  14. slug = slugOfHost(host)
  15. repo = repoAt(slug)
  16. hasRepo = repo != null
  17. isOwner = repo != null && ownsRepo(slug, session)
  18. connected = repo != null && repo.ticketsOn
  19. notConnected = repo != null && !repo.ticketsOn
  20. projectTitle = repo != null ? repo.ticketsTitle : ''
  21. projectHref = repo != null && repo.ticketsOn ? ticketsUrl + '/projects/' + repo.ticketsProject : ''
  22. connectNote = session != null && session.data != null && session.data.connectNote != null ? session.data.connectNote : ''
  23. hasConnectNote = connectNote != ''
  24. notOwnerHint = repo != null && !isOwner
  25. settingsError = ''
  26. forgetClass = repo != null && repo.ticketsOn ? 'quiet' : 'nomerge'
  27. __title = pageTitle(siteName, slug, 'Settings')
  28. View {
  29. repoPage {
  30. RepoHead { }
  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. let 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. let r = setTicketsConnection(slugOf, '', '', '', '')
  71. if (r.error != null) { return { error = r.error } }
  72. return { ok = true }
  73. }

Branches

Latest commits

  • 3dc43108antcolony#40: mission references point to the moved missionsmre
  • 8d9450fdantcolony#40: history (LOG.md), worker briefs (missions/) and reports moved here from antcolony, numbered per project; old numbers in antcolony docs/mission-map.mdmre
  • 205d5fe4gitoria: Hybriel master ff51cf46; ssh keys/tokens no double rows (session sync); gates follow #20mre
  • 9b27cb26gitoria#21: installable app (manifest, service worker, offline start page), own iconmre
  • 68dcb603deploy.sh: back up live storage/.sessions/.env before every deploy (newest 5 kept)mre
  • e2deed6dgitoria#20: "Add code" only on the Code page of an empty repository, no collapsiblemre
  • 8bb97ffddeploy.sh: never send .git or .gitignore to Byrodinmre
  • fd981932State of 2026-09-27; bin/ no longer tracked (Hybriel commit is in README)mre
  • 4a2d7125initial commitmre