gitoria
All repositories: gitoria
4.0 KB
// components/pulls.hl — THE PULL REQUESTS of a repo (gitoria#11, gitoria#16): `/pulls` on <slug>.<domain>, its// own route. The repo head is rendered on the server from the request's host. The list comes from git (the// commits whose message starts with |||PR) on the SERVER too// (lib/pulls.hl pullsNow — hl:proc run() waits, hybriel#80): it is in the first HTML and in every hl:web navigation.parent './repo.hl'import { siteName } from '../project.hl'import { slugOfRequest } from '../lib/orgs.hl'import { userOfSession } from '../lib/users.hl'import { titleSlug, repoAt, ownsRepo } from '../lib/repos.hl'import { pageTitle } from '../lib/repos-helpers.hl'import { pullsNow, mergePullNow, withMerge, pullsView } from '../lib/pulls.hl'import { withPullParts } from '../lib/tickets-helpers.hl'import { notifyPush } from '../lib/tickets.hl'host = nullorepo = ''session = nullslug = slugOfRequest(host, orepo)repo = repoAt(slug, session)hasRepo = repo != nullisOwner = repo != null && ownsRepo(slug, session)mergeError = ''got = repo != null ? pullsNow(slug, repo.branch) : nullpullsShown = got != null && !got.isMessagepullsMessage = got != null && got.isMessagepullsText = got != null && got.isMessage ? got.message : ''pullsNone = got != null && !got.isMessage && got.noPullspullsList = got != null && !got.isMessage ? withPullParts(withMerge(got.pulls, isOwner), repo.ticketsProject) : []pullsDefault = got != null && !got.isMessage ? got.defaultName : ''__title = pageTitle(siteName, titleSlug(host, orepo, session), 'Pull requests')View {repoPage {if (hasRepo) {repoPulls { id = "pulls"if (pullsMessage) { p { id = "pullsmessage" class = "empty" pullsText } }if (pullsShown) {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)." }if (pullsNone) { p { id = "nopulls" class = "empty" "No pull request yet." } }p { id = "mergeerror" class = "message" mergeError }ol { id = "pulllist"for (pr of pullsList) {li {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 } } } }span { class = pr.state pr.state }span { class = "branches"if (pr.hasSource) { a { class = "source" href = pr.sourceHref pr.source } }if (pr.noSource) { span { class = "source muted" "(branch gone)" } }span { class = "muted" "→" }if (pr.targetLinked) { a { class = "target" href = pr.targetHref pr.target } }if (pr.targetMissing) { span { class = "target muted" pr.target " (no such branch)" } }}span { class = "muted" pr.author }time { pr.date }button { class = pr.mergeClass type = "button" value = pr.sha "Merge" on click(e) { emit mergePull(e.target.value) } }}}}}}}}}// "Merge" (the owner, only when clicked): the face merges and answers with the list read againon mergePull(sha) {mergeError = ''r = emit server gitoriaMergePull(slug, sha)if (r == null || r.error != null) {mergeError = r != null ? r.error : 'could not merge'return null}got = r.resultpullsList = r.listpullsNone = got.noPulls}on server gitoriaMergePull(slugOf, sha, session) {if (session == null || repoAt(slugOf, session) == null) { return { error = 'could not merge' } }u = userOfSession(session)if (u == null || !ownsRepo(slugOf, session)) { return { error = 'only the owner can merge a pull request' } }r = mergePullNow(slugOf, repoAt(slugOf, session).branch, sha, u.name)if (r.error != null) { return { error = r.error } }notifyPush(slugOf, false)// the list again, with its ticket links made here: tickets-helpers.hl reads the environment, which the browser has notreturn pullsView(slugOf, repoAt(slugOf, session).branch, true, repoAt(slugOf, session).ticketsProject)}
Branches
Latest commits
- a81abdc9gitoria#34: org page via function route, member-reachable orgs, selects, reportmre
- 17f031f0gitoria#34: private repos, organizations, members, move tool, gatemre
- 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