gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit43ad2bcf43ad2bcfgitoria header: the selector alone plus your name and Log out as before the theme missions; tests follow (WIP: host-only cookie experiment fails)mre43ad2bcf/components/pulls.hl

3.9 KB

  1. // components/pulls.hl — THE PULL REQUESTS of a repo (gitoria#11, gitoria#16): `/pulls` on <slug>.<domain>, its
  2. // own route. The repo head is rendered on the server from the request's host. The list comes from git (the
  3. // commits whose message starts with |||PR) on the SERVER too
  4. // (lib/pulls.hl pullsNow — hl:proc run() waits, hybriel#80): it is in the first HTML and in every hl:web navigation.
  5. parent './repo.hl'
  6. import { siteName } from '../project.hl'
  7. import { slugOfHost } from '../lib/util.hl'
  8. import { userOfSession } from '../lib/users.hl'
  9. import { repoAt, ownsRepo } from '../lib/repos.hl'
  10. import { pageTitle } from '../lib/repos-helpers.hl'
  11. import { pullsNow, mergePullNow, withMerge, pullsView } from '../lib/pulls.hl'
  12. import { withPullParts } from '../lib/tickets-helpers.hl'
  13. import { notifyPush } from '../lib/tickets.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. mergeError = ''
  21. got = repo != null ? pullsNow(slug, repo.branch) : null
  22. pullsShown = got != null && !got.isMessage
  23. pullsMessage = got != null && got.isMessage
  24. pullsText = got != null && got.isMessage ? got.message : ''
  25. pullsNone = got != null && !got.isMessage && got.noPulls
  26. pullsList = got != null && !got.isMessage ? withPullParts(withMerge(got.pulls, isOwner), repo.ticketsProject) : []
  27. pullsDefault = got != null && !got.isMessage ? got.defaultName : ''
  28. __title = pageTitle(siteName, slug, 'Pull requests')
  29. View {
  30. repoPage {
  31. if (hasRepo) {
  32. repoPulls { id = "pulls"
  33. if (pullsMessage) { p { id = "pullsmessage" class = "empty" pullsText } }
  34. if (pullsShown) {
  35. p { id = "pullshelp" class = "muted" "A commit whose message starts with " code { "|||PR " } " opens a pull request; " code { "|||PR|branch] " } " sets the target (now: " strong { pullsDefault } " by default)." }
  36. if (pullsNone) { p { id = "nopulls" class = "empty" "No pull request yet." } }
  37. p { id = "mergeerror" class = "message" mergeError }
  38. ol { id = "pulllist"
  39. for (pr of pullsList) {
  40. li {
  41. span { class = "subject" for (pt of pr.parts) { if (pt.isText) { a { href = pr.href pt.text } } if (pt.isLink) { a { class = "ticketref" href = pt.href pt.text } } } }
  42. span { class = pr.state pr.state }
  43. span { class = "branches"
  44. if (pr.hasSource) { a { class = "source" href = pr.sourceHref pr.source } }
  45. if (pr.noSource) { span { class = "source muted" "(branch gone)" } }
  46. span { class = "muted" "→" }
  47. if (pr.targetLinked) { a { class = "target" href = pr.targetHref pr.target } }
  48. if (pr.targetMissing) { span { class = "target muted" pr.target " (no such branch)" } }
  49. }
  50. span { class = "muted" pr.author }
  51. time { pr.date }
  52. button { class = pr.mergeClass type = "button" value = pr.sha "Merge" on click(e) { emit mergePull(e.target.value) } }
  53. }
  54. }
  55. }
  56. }
  57. }
  58. }
  59. }
  60. }
  61. // "Merge" (the owner, only when clicked): the face merges and answers with the list read again
  62. on mergePull(sha) {
  63. mergeError = ''
  64. r = emit server gitoriaMergePull(slug, sha)
  65. if (r == null || r.error != null) {
  66. mergeError = r != null ? r.error : 'could not merge'
  67. return null
  68. }
  69. got = r.result
  70. pullsList = r.list
  71. pullsNone = got.noPulls
  72. }
  73. on server gitoriaMergePull(slugOf, sha, session) {
  74. if (session == null || repoAt(slugOf) == null) { return { error = 'could not merge' } }
  75. u = userOfSession(session)
  76. if (u == null || !ownsRepo(slugOf, session)) { return { error = 'only the owner can merge a pull request' } }
  77. r = mergePullNow(slugOf, repoAt(slugOf).branch, sha, u.name)
  78. if (r.error != null) { return { error = r.error } }
  79. notifyPush(slugOf, false)
  80. // the list again, with its ticket links made here: tickets-helpers.hl reads the environment, which the browser has not
  81. return pullsView(slugOf, repoAt(slugOf).branch, true, repoAt(slugOf).ticketsProject)
  82. }

Branches

Latest commits

  • 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
  • 9da65b42tests/browser.mjs: 404 checks (host, no hydration wait)MG
  • 00517fafgitoria: shell 404 page for unknown paths (catch-all route, status 404, JSON 404 under /api), 390 gate checksMG
  • d9e977f0reports/MG-mobile.md, LOGMG
  • 2f2725actests/browser.mjs: commit-row check (one row, centred date)MG
  • 4df1ea01tests/browser.mjs: MG phone checks (list first, no dead strip, one branch heading, tab grid, commit rows, PR title row, ticket columns, wrapping commands)MG
  • c52424e9gitoria mobile: repo list before the forms, 3x2 tab grid, no duplicate branch heading, ordered commit rows, aligned ticket rows, pull title on its own row, wrapping clone commands, no dead strip under formsMG
  • 3a95252dG3: cache parsed README blocks by sha256 of the text (bounded LRU), reportmre
  • 570138cddeploy: security gate (tests/security.mjs)mre
  • da6b20fcgitoria SG: security audit fixes (uploadMax 0, Secure cookie on https, session rotation at login, nosniff on function routes, no identity in page data) + tests/security.mjs gate + reportmre
  • f98c981fgitoria B1: report wordingmre
  • c6364cedgitoria B1: compact Markdown blocks (one kind flag per block/span, empty and false fields omitted); same rendered HTML, page values -67%mre
  • cd99d2feWIP gitoria#22: always render the repo level's slot (missing-repo boot hang), pages render nothing without a repo; hydration diagnosis in reports/G2-hydrate.mdmre
  • e5404b9breport: commit idsmre