gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit61b72ded61b72dedgitoria#25: re-vendor Hybriel master c1b1010f (W149 page cache), key the repo Readme page by slug and main commit, extend the readme-cache gatemre61b72ded/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

  • 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