Public: anyone can read this; the crew can change it.
Pinpoint, part 2: copyable comment links, Reply in line threads, linked diff lines, a sign-in hint on not-found (#16423) #16427
Check · Review · Land · Live done — Landed and live in production.
fix/pinpoint-2 → main 0 commits 1 thread · 1 unresolved
17 files
changed +419
−41
docs/design/areas/pinpoint.md +2
| @@ -4,3 +4,5 @@ A row that stands for an issue or a pull leads its meta line with its number, `. | ||
| 4 | 4 | just now`), at every width, so a person on a phone can say which one they mean |
| 5 | 5 | (`test/row-numbers.test.ts`). A page's own `#N` beside its title is a link to itself, and a |
| 6 | 6 | comment's time links to the comment's anchor (`.permalink`), each an address to copy or share. |
| 7 | ||
| 8 | - `.dl-bar`: the bar a tapped diff line opens on a touch screen, under that line: Copy link and Comment, held in view when the diff scrolls sideways. |
docs/features/pinpoint.md added +32
| @@ -0,0 +1,32 @@ | ||
| 1 | --- | |
| 2 | topic: Ship and undo | |
| 3 | row: Every comment and diff line has its own address | |
| 4 | --- | |
| 5 | ||
| 6 | # Pointing at one thing | |
| 7 | ||
| 8 | Every comment, every changed line and every number has an address you can send. | |
| 9 | ||
| 10 | ## On the page | |
| 11 | ||
| 12 | - **A comment:** its time is a link to itself (`#c-<id>` on an issue, `#rc-<id>` on a pull's | |
| 13 | line comment). With script on, **Copy link** beside it copies the full address. | |
| 14 | - **A diff line:** its number is a link to that line (`#d-<file>-R<line>`). The page opens | |
| 15 | scrolled to it, with the line marked. The `+` beside the number comments on that line, and a | |
| 16 | line comment's thread has **Reply** under it. On a phone the lines keep their reading size: | |
| 17 | tap anywhere on a line to select it (its address goes in the bar) and a bar opens under it | |
| 18 | with **Copy link** and **Comment**, each a full thumb target. | |
| 19 | - **A reference in a comment:** `#12` links to issue or pull 12 of the repository, and | |
| 20 | `src/cart.ts:31` links to that line of the file on the default branch. Inside code it stays | |
| 21 | code. | |
| 22 | - **A link into a private repository, signed out:** the page reads the same as a missing one, | |
| 23 | and **sign in** brings you back to the address you opened. | |
| 24 | ||
| 25 | ## In the terminal | |
| 26 | ||
| 27 | Open a pull, go to its diff tab, put the cursor on a line and press `c`: the comment is anchored | |
| 28 | to that line, and its thread shows under it, as on the page. The terminal has no addresses to | |
| 29 | copy; it walks to the line instead. | |
| 30 | ||
| 31 | `src/web/comments.ts` (permalinks and references) and `src/web/diff-view.ts` (line addresses) | |
| 32 | draw the page; `src/tui/screens/pull.ts` is the terminal's side. |
src/web/chrome.ts +8 −1
| @@ -88,10 +88,17 @@ export function notFoundPage(ctx: Ctx, opts: { plain?: boolean; noEcho?: boolean | ||
| 88 | 88 | if (typed) return typed; |
| 89 | 89 | if (opts.signedOut === true || (!opts.plain && ctx.auth.user === undefined)) { |
| 90 | 90 | // A signed-out visitor learns one thing: it is not here; two ways on, and nothing of the path. |
| 91 | // A link someone shared may be to a private repository: the same words, and the same page, for a | |
| 92 | // missing one and a private one (the 404 parity holds), with one more way on: signing in. | |
| 91 | 93 | const id = requestId(); |
| 94 | const get = !opts.plain && (ctx.request.method === "GET" || ctx.request.method === "HEAD"); | |
| 95 | // Signing in comes back to this address: the visitor's own, the same words whether the repository | |
| 96 | // is private or missing, so the parity holds (`returnTo`, checked as a path on this forge). | |
| 97 | const back = withReturn("/signin", opts.noEcho === true ? undefined : returnTo(ctx)); | |
| 98 | const signIn = get ? html`<p class="muted">If it's private, <a href="${back}">sign in</a>.</p>` : html``; | |
| 92 | 99 | const res = leanPage( |
| 93 | 100 | "Not found", |
| 94 | html`<h1>That page is not here.</h1><p>${btn("Home", { href: "/", variant: "primary" })} ${btn("Search", { href: "/search" })}</p>`, | |
| 101 | html`<h1>That page is not here.</h1>${signIn}<p>${btn("Home", { href: "/", variant: "primary" })} ${btn("Search", { href: "/search" })}</p>`, | |
| 95 | 102 | 404, |
| 96 | 103 | ); |
| 97 | 104 | res.headers.set("x-request-id", id); |
src/web/client.ts +46 −1
| @@ -1365,6 +1365,51 @@ export const moduleLoaderJs = /* js */ ` | ||
| 1365 | 1365 | } |
| 1366 | 1366 | `; |
| 1367 | 1367 | |
| 1368 | /** | |
| 1369 | * A diff line on a touch screen (#16427): the pages that draw a diff carry it, not the shell. | |
| 1370 | */ | |
| 1371 | export const diffTapJs = /* js */ ` | |
| 1372 | // ---- a diff line on a touch screen: the whole row is the target ---- | |
| 1373 | // A thumb cannot hit a line number at reading size, so a tap anywhere on a line selects it (its | |
| 1374 | // address in the bar, the line marked) and opens one bar under it: Copy link and Comment, each a | |
| 1375 | // full-size button. The rows keep their height; without script the number is still the link. | |
| 1376 | (function () { | |
| 1377 | var doc = document; | |
| 1378 | if (doc.querySelector('.diff-table') && window.matchMedia && matchMedia('(pointer: coarse)').matches) { | |
| 1379 | doc.addEventListener('click', function (e) { | |
| 1380 | var t = e.target; | |
| 1381 | if (!t || !t.closest || t.closest('a, button, input, textarea, summary, .dl-bar')) return; | |
| 1382 | var tr = t.closest('.diff-table tr.dl[id]'); | |
| 1383 | if (!tr) return; | |
| 1384 | doc.querySelectorAll('.diff-table tr[data-hl]').forEach(function (r) { r.removeAttribute('data-hl'); }); | |
| 1385 | var old = doc.querySelector('.dl-bar'); | |
| 1386 | if (old) old.parentNode.removeChild(old); | |
| 1387 | history.replaceState(history.state, '', '#' + tr.id); | |
| 1388 | tr.setAttribute('data-hl', ''); | |
| 1389 | var bar = doc.createElement('tr'); | |
| 1390 | bar.className = 'dl-bar'; | |
| 1391 | var td = doc.createElement('td'); | |
| 1392 | td.colSpan = tr.children.length; | |
| 1393 | var link = doc.createElement('a'); | |
| 1394 | link.id = 'dl-bar-link'; link.href = '#' + tr.id; link.hidden = true; | |
| 1395 | var copy = doc.createElement('button'); | |
| 1396 | copy.type = 'button'; copy.className = 'btn'; copy.setAttribute('data-copy', 'dl-bar-link'); copy.textContent = 'Copy link'; | |
| 1397 | var hold = doc.createElement('span'); | |
| 1398 | hold.appendChild(link); hold.appendChild(copy); | |
| 1399 | var say = tr.querySelector('a.dn-comment[aria-label]'); | |
| 1400 | if (say) { | |
| 1401 | var go = doc.createElement('a'); | |
| 1402 | go.className = 'btn'; go.href = say.getAttribute('href'); go.textContent = 'Comment'; | |
| 1403 | hold.appendChild(go); | |
| 1404 | } | |
| 1405 | td.appendChild(hold); | |
| 1406 | bar.appendChild(td); | |
| 1407 | tr.parentNode.insertBefore(bar, tr.nextSibling); | |
| 1408 | }); | |
| 1409 | } | |
| 1410 | })(); | |
| 1411 | `; | |
| 1412 | ||
| 1368 | 1413 | const shellCore = /* js */ ` |
| 1369 | 1414 | (function () { |
| 1370 | 1415 | var doc = document; |
| @@ -1443,7 +1488,7 @@ const shellCore = /* js */ ` | ||
| 1443 | 1488 | done(selectText(src) ? 'Selected — press Ctrl/Cmd+C' : 'Copy it by hand'); |
| 1444 | 1489 | } |
| 1445 | 1490 | if (!navigator.clipboard) { fallback(); return; } |
| 1446 | navigator.clipboard.writeText((src.value !== undefined ? src.value : src.textContent).trim()).then(function () { | |
| 1491 | navigator.clipboard.writeText((src.tagName === 'A' ? src.href : src.value !== undefined ? src.value : src.textContent).trim()).then(function () { | |
| 1447 | 1492 | done('Copied'); |
| 1448 | 1493 | }, fallback); |
| 1449 | 1494 | }); |
src/web/comments.ts +57 −4
| @@ -7,9 +7,9 @@ | ||
| 7 | 7 | |
| 8 | 8 | import type { Mark } from "../core/marks.ts"; |
| 9 | 9 | import { emptyNote } from "./empty_words.ts"; |
| 10 | import { html, when, type Html } from "./html.ts"; | |
| 10 | import { html, raw, when, type Html } from "./html.ts"; | |
| 11 | 11 | import { renderMarkdown } from "./markdown.ts"; |
| 12 | import { originTag, popout, time, userLink, type IconName } from "./ui.ts"; | |
| 12 | import { btn, originTag, popout, time, userLink, type IconName } from "./ui.ts"; | |
| 13 | 13 | |
| 14 | 14 | export interface CommentCard { |
| 15 | 15 | /** "" for the opener (the issue/PR body), which has no comment row. */ |
| @@ -29,6 +29,57 @@ export interface CommentCard { | ||
| 29 | 29 | originUrl?: string | null; |
| 30 | 30 | /** The id the page gives this comment, so its time links to it: the address to share. */ |
| 31 | 31 | anchor?: string; |
| 32 | /** The repository the comment is in: `#N` and `path:line` in its body link there (`linkRefs`). */ | |
| 33 | refs?: Refs; | |
| 34 | } | |
| 35 | ||
| 36 | export interface Refs { | |
| 37 | /** The repository's base path (`/owner/name`). */ | |
| 38 | readonly base: string; | |
| 39 | /** The branch a `path:line` is read on. */ | |
| 40 | readonly ref: string; | |
| 41 | } | |
| 42 | ||
| 43 | /** Tags inside which no text becomes a link: one already, and code. */ | |
| 44 | const INERT_OPEN = /^<(a|code|pre)\b/i; | |
| 45 | const INERT_CLOSE = /^<\/(a|code|pre)>/i; | |
| 46 | ||
| 47 | /** | |
| 48 | * A rendered body with what names a thing in this repository made its link, where it is | |
| 49 | * unambiguous: `#12` (an issue or pull, `/issues/12` answers both) and `src/cart.ts:30` or | |
| 50 | * `src/cart.ts#L30` (that line on the default branch). Text in a link, code or a code block stays | |
| 51 | * as it is; a bare "line 14" names no file and is left alone. | |
| 52 | */ | |
| 53 | export function linkRefs(body: Html, refs: Refs): Html { | |
| 54 | let inert = 0; | |
| 55 | return raw( | |
| 56 | body.text | |
| 57 | .split(/(<[^>]+>)/) | |
| 58 | .map((part) => { | |
| 59 | if (part.startsWith("<")) { | |
| 60 | if (INERT_OPEN.test(part)) inert++; | |
| 61 | else if (INERT_CLOSE.test(part)) inert = Math.max(0, inert - 1); | |
| 62 | return part; | |
| 63 | } | |
| 64 | if (inert > 0) return part; | |
| 65 | return part | |
| 66 | .replace(/(^|[\s(])#(\d{1,7})\b/g, (_, pre: string, n: string) => `${pre}<a href="${refs.base}/issues/${n}">#${n}</a>`) | |
| 67 | .replace( | |
| 68 | /(^|[\s(])((?:[\w.-]+\/)*[\w-]+\.[A-Za-z0-9]{1,8})(?::|#L)(\d{1,6})\b/g, | |
| 69 | (_, pre: string, path: string, line: string) => | |
| 70 | `${pre}<a href="${refs.base}/blob/${encodeURIComponent(refs.ref)}/${path.split("/").map(encodeURIComponent).join("/")}#L${line}">${path}:${line}</a>`, | |
| 71 | ); | |
| 72 | }) | |
| 73 | .join(""), | |
| 74 | ); | |
| 75 | } | |
| 76 | ||
| 77 | /** | |
| 78 | * A comment's time as the link to it, and beside it a Copy link button (the link's address; with | |
| 79 | * no script, the link itself is there to long-press). `anchor` is the id the page gives the comment. | |
| 80 | */ | |
| 81 | export function permalink(anchor: string, at: string): Html { | |
| 82 | return html`<a class="permalink" id="cl-${anchor}" href="#${anchor}" title="This comment's address">${time(at)}</a> ${btn("Copy link", { size: "sm", variant: "ghost", type: "button", copy: `cl-${anchor}`, label: "Copy this comment's link", extra: "js-only" })}`; | |
| 32 | 83 | } |
| 33 | 84 | |
| 34 | 85 | export function commentCard(card: CommentCard): Html { |
| @@ -36,7 +87,9 @@ export function commentCard(card: CommentCard): Html { | ||
| 36 | 87 | const bodyHtml = |
| 37 | 88 | card.body.trim() === "" |
| 38 | 89 | ? emptyNote("noDescription") |
| 39 | : renderMarkdown(card.body); | |
| 90 | : card.refs === undefined | |
| 91 | ? renderMarkdown(card.body) | |
| 92 | : linkRefs(renderMarkdown(card.body), card.refs); | |
| 40 | 93 | const byline = |
| 41 | 94 | card.originAuthor != null && card.originAuthor !== "" |
| 42 | 95 | ? originTag(card.originAuthor, card.originKind ?? "globe") |
| @@ -44,7 +97,7 @@ export function commentCard(card: CommentCard): Html { | ||
| 44 | 97 | return html`<div ${idAttr}class="comment-row"> |
| 45 | 98 | <div class="comment-head"> |
| 46 | 99 | ${byline} |
| 47 | <span class="muted">${card.verb} ${card.anchor === undefined ? time(card.at) : html`<a class="permalink" href="#${card.anchor}" title="This comment's address">${time(card.at)}</a>`}</span> | |
| 100 | <span class="muted">${card.verb} ${card.anchor === undefined ? time(card.at) : permalink(card.anchor, card.at)}</span> | |
| 48 | 101 | ${when( |
| 49 | 102 | card.originUrl != null && card.originUrl !== "", |
| 50 | 103 | () => html`<span class="spacer"></span> |
src/web/diff-view.ts +37 −10
| @@ -22,8 +22,9 @@ import { composeLine } from "./code.ts"; | ||
| 22 | 22 | import type { Token } from "./highlight.ts"; |
| 23 | 23 | import { escapeHtml, html, raw, when, type Html } from "./html.ts"; |
| 24 | 24 | import { urlPath } from "./pages/explorer.ts"; |
| 25 | import { btn, card, disclosure, empty, icon, time, userLink } from "./ui.ts"; | |
| 25 | import { btn, card, disclosure, empty, icon, listCard, row, time, userLink } from "./ui.ts"; | |
| 26 | 26 | import { renderMarkdown } from "./markdown.ts"; |
| 27 | import { permalink } from "./comments.ts"; | |
| 27 | 28 | import { wordDiff, type Segment } from "./worddiff.ts"; |
| 28 | 29 | |
| 29 | 30 | /** Highlighted tokens per side for a file, keyed by path in a SyntaxMap. */ |
| @@ -258,14 +259,15 @@ function renderRow(row: Row, ctx: RowCtx): Html { | ||
| 258 | 259 | const side: Side = row.kind === "del" ? "old" : "new"; |
| 259 | 260 | const lineNo = side === "old" ? row.oldNumber : row.newNumber; |
| 260 | 261 | |
| 262 | // The line's own address: its number is the link to it, on the side a comment anchors to. | |
| 263 | const rowId = lineNo === null ? undefined : lineAnchor(path, side, lineNo); | |
| 261 | 264 | const gutter = (n: number | null, isAnchorSide: boolean) => { |
| 262 | 265 | if (n === null) return html`<td class="dn"></td>`; |
| 263 | if (!opts.reviewBase || !isAnchorSide) | |
| 264 | return html`<td class="dn">${n}</td>`; | |
| 266 | if (!isAnchorSide || rowId === undefined) return html`<td class="dn">${n}</td>`; | |
| 267 | const self = html`<a class="dn-comment" href="#${rowId}" title="This line's address">${n}</a>`; | |
| 268 | if (!opts.reviewBase) return html`<td class="dn">${self}</td>`; | |
| 265 | 269 | const href = `${opts.reviewPage ?? opts.reviewBase}?rc=${encodeURIComponent(path)}~${side}~${n}#rc`; |
| 266 | return html`<td class="dn"> | |
| 267 | <a class="dn-comment" href="${href}" title="Comment on this line">${n}</a> | |
| 268 | </td>`; | |
| 270 | return html`<td class="dn">${self}<a class="dn-comment" href="${href}" title="Comment on this line" aria-label="Comment on line ${n}">+</a></td>`; | |
| 269 | 271 | }; |
| 270 | 272 | |
| 271 | 273 | // `.dc` is `white-space: pre`, so the cell's contents are assembled here, |
| @@ -278,7 +280,7 @@ function renderRow(row: Row, ctx: RowCtx): Html { | ||
| 278 | 280 | row.noNewline, |
| 279 | 281 | () => html`<span class="nonl" title="No newline at end of file">↵</span>`, |
| 280 | 282 | )}`; |
| 281 | const rowHtml = html`<tr class="dl" data-k="${row.kind}"> | |
| 283 | const rowHtml = html`<tr class="dl" data-k="${row.kind}"${rowId === undefined ? null : html` id="${rowId}"`}> | |
| 282 | 284 | ${gutter(row.oldNumber, side === "old")}${gutter( |
| 283 | 285 | row.newNumber, |
| 284 | 286 | side === "new", |
| @@ -314,10 +316,10 @@ function reviewRows( | ||
| 314 | 316 | const currentHash = hashLine(currentText); |
| 315 | 317 | const thread = comments.map((c) => { |
| 316 | 318 | const outdated = c.lineHash !== currentHash; |
| 317 | return html`<div class="comment-row"> | |
| 319 | return html`<div class="comment-row" id="rc-${c.id}"> | |
| 318 | 320 | <div class="comment-head muted small"> |
| 319 | 321 | ${userLink(c.authorName, { mark: opts.marks?.get(c.authorName) })} |
| 320 | ${time(c.createdAt)} | |
| 322 | ${permalink(`rc-${c.id}`, c.createdAt)} | |
| 321 | 323 | ${when( |
| 322 | 324 | outdated, |
| 323 | 325 | () => html`<span class="badge" data-variant="danger">outdated</span>`, |
| @@ -396,7 +398,7 @@ function reviewRows( | ||
| 396 | 398 | )}`, |
| 397 | 399 | toggle ? { foot: toggle } : {}, |
| 398 | 400 | ) |
| 399 | : html`<div class="dc-thread">${thread}${toggle}</div>`; | |
| 401 | : html`<div class="dc-thread">${thread}${reply(opts, path, side, line, isActive)}${toggle}</div>`; | |
| 400 | 402 | |
| 401 | 403 | return html`<tr> |
| 402 | 404 | <td class="dn"></td> |
| @@ -405,6 +407,30 @@ function reviewRows( | ||
| 405 | 407 | </tr>`; |
| 406 | 408 | } |
| 407 | 409 | |
| 410 | /** | |
| 411 | * Answer a line's thread where it is: a comment on the same line joins its thread (the same form a | |
| 412 | * new line comment posts). Folded, so the thread stays short; none while the line's own form is open. | |
| 413 | */ | |
| 414 | function reply(opts: DiffViewOptions, path: string, side: Side, line: number, open: boolean): Html | null { | |
| 415 | if (!opts.reviewBase || open) return null; | |
| 416 | return html`<details class="dc-reply"> | |
| 417 | <summary class="btn" data-size="sm" data-variant="ghost">Reply</summary> | |
| 418 | <form class="comment-form" data-submit-key method="post" action="${opts.reviewBase}/review"> | |
| 419 | <input type="hidden" name="path" value="${path}" /> | |
| 420 | <input type="hidden" name="side" value="${side}" /> | |
| 421 | <input type="hidden" name="line" value="${line}" /> | |
| 422 | <label class="sr-only" for="rr-${lineAnchor(path, side, line)}">Reply on this line</label> | |
| 423 | <textarea class="input" id="rr-${lineAnchor(path, side, line)}" name="body" rows="3" data-grow placeholder="Reply" required></textarea> | |
| 424 | <div class="form-actions">${btn("Reply", { size: "sm", variant: "primary", type: "submit" })}</div> | |
| 425 | </form> | |
| 426 | </details>`; | |
| 427 | } | |
| 428 | ||
| 429 | /** A diff line's id: its file's anchor, then `R<n>` on the new side or `L<n>` on the old. */ | |
| 430 | export function lineAnchor(path: string, side: Side, line: number): string { | |
| 431 | return `${pathAnchor(path)}-${side === "new" ? "R" : "L"}${String(line)}`; | |
| 432 | } | |
| 433 | ||
| 408 | 434 | /** |
| 409 | 435 | * Resolve, or take it back. A writer may settle any thread; so may whoever |
| 410 | 436 | * commented in it — the reviewer who raised a point is exactly the person |
| @@ -584,6 +610,7 @@ export function renderDiff( | ||
| 584 | 610 | changed <span class="add">+${diff.additions}</span> |
| 585 | 611 | <span class="del">−${diff.deletions}</span> |
| 586 | 612 | </div> |
| 613 | ${when(shown.length > 1, () => listCard(shown.map((f) => row({ href: `#${fileAnchor(f)}`, title: html`<span class="mono">${f.path}</span>` }))))} | |
| 587 | 614 | ${shown.map((file) => fileView(file, opts))} |
| 588 | 615 | ${when( |
| 589 | 616 | hidden > 0, |
src/web/pages/commits.ts +3 −2
| @@ -10,6 +10,7 @@ | ||
| 10 | 10 | * list can do neither, so the live browse pages by cursor and says so. |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | import { diffTapJs } from "../client.ts"; | |
| 13 | 14 | import { immutableWhenAddressed } from "../../http/addressed.ts"; |
| 14 | 15 | import { checkOfCommit, verdictsOfCommits } from "../../actions/runs.ts"; |
| 15 | 16 | import type { CommitCheck } from "../../checks/commit_check.ts"; |
| @@ -261,7 +262,7 @@ export async function commitsPage(ctx: Ctx): Promise<Response> { | ||
| 261 | 262 | palette: scope.palette, |
| 262 | 263 | body: html`${scopeHeader(ctx, scope, "commits")}${switcher} |
| 263 | 264 | ${noCommits(num > 1)} ${liveMount({ repo: base })}`, |
| 264 | scriptJs: liveClientJs, | |
| 265 | scriptJs: `${liveClientJs}\n${diffTapJs}`, | |
| 265 | 266 | styleCss: COMMITS_CSS, |
| 266 | 267 | }); |
| 267 | 268 | notePhase(ctx.request, "render", performance.now() - rendering); |
| @@ -289,7 +290,7 @@ export async function commitsPage(ctx: Ctx): Promise<Response> { | ||
| 289 | 290 | crumbs: scope.crumbs, |
| 290 | 291 | palette: scope.palette, |
| 291 | 292 | body, |
| 292 | scriptJs: liveClientJs, | |
| 293 | scriptJs: `${liveClientJs}\n${diffTapJs}`, | |
| 293 | 294 | styleCss: COMMITS_CSS, |
| 294 | 295 | }); |
| 295 | 296 | notePhase(ctx.request, "render", performance.now() - rendering); |
src/web/pages/pull.ts +5 −9
| @@ -101,7 +101,7 @@ import { waitingOnTeams } from "../../core/teams_words.ts"; | ||
| 101 | 101 | import { teamsHolding, teamVerdicts, type TeamVerdict } from "../../core/issue_teams.ts"; |
| 102 | 102 | import { html, raw, when, type Html } from "../html.ts"; |
| 103 | 103 | import { flashTo, fragment, page, redirect } from "../layout.ts"; |
| 104 | import { liveRegionsJs } from "../client.ts"; | |
| 104 | import { diffTapJs, liveRegionsJs } from "../client.ts"; | |
| 105 | 105 | import { liveClientJs, liveMount } from "../live.ts"; |
| 106 | 106 | import { |
| 107 | 107 | avatar, |
| @@ -1211,7 +1211,7 @@ export async function pullFilesPage(ctx: Ctx): Promise<Response> { | ||
| 1211 | 1211 | ${crewActivityCard(ctx, repo, pull)} |
| 1212 | 1212 | </aside> |
| 1213 | 1213 | </div> |
| 1214 | <div class="mt">${keptRender(renderKey, () => renderDiff(diff, diffOptions))}</div> | |
| 1214 | <div class="mt" id="diff">${keptRender(renderKey, () => renderDiff(diff, diffOptions))}</div> | |
| 1215 | 1215 | ${liveMount({ repo: base })}`; |
| 1216 | 1216 | |
| 1217 | 1217 | const response = page({ |
| @@ -1245,7 +1245,7 @@ export async function pullFilesPage(ctx: Ctx): Promise<Response> { | ||
| 1245 | 1245 | ], |
| 1246 | 1246 | body, |
| 1247 | 1247 | styleCss: labelCss([...allLabels, ...applied]), |
| 1248 | scriptJs: `${liveClientJs}\n${liveRegionsJs}`, | |
| 1248 | scriptJs: `${liveClientJs}\n${liveRegionsJs}\n${diffTapJs}`, | |
| 1249 | 1249 | }); |
| 1250 | 1250 | const { diff: diffMs, git, checks, reviews } = spent; |
| 1251 | 1251 | notePhase(ctx.request, "diff", diffMs, diffHit); |
| @@ -1309,11 +1309,6 @@ export async function pullCommentSubmit(ctx: Ctx): Promise<Response> { | ||
| 1309 | 1309 | : flashTo(ctx, `${dest}`, { message: "Comment posted." }); |
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | /** Match the diff viewer's per-file anchor id, so the redirect lands there. */ | |
| 1313 | function fileHashAnchor(path: string): string { | |
| 1314 | return "d-" + path.replace(/[^a-zA-Z0-9]+/g, "-"); | |
| 1315 | } | |
| 1316 | ||
| 1317 | 1312 | // POST /:owner/:name/pulls/:number/review — a comment anchored to a diff line. |
| 1318 | 1313 | export async function pullReviewSubmit(ctx: Ctx): Promise<Response> { |
| 1319 | 1314 | const found = pullContext(ctx); |
| @@ -1361,7 +1356,8 @@ export async function pullReviewSubmit(ctx: Ctx): Promise<Response> { | ||
| 1361 | 1356 | : "That review comment could not be saved.", |
| 1362 | 1357 | }); |
| 1363 | 1358 | } |
| 1364 | return flashTo(ctx, `${dest}#${fileHashAnchor(anchor.path)}`, { | |
| 1359 | // It lands on the comment itself (`diff-view.ts`: `rc-<id>`), the address it now has. | |
| 1360 | return flashTo(ctx, `${dest}#rc-${added.value.id}`, { | |
| 1365 | 1361 | message: "Review comment added.", |
| 1366 | 1362 | }); |
| 1367 | 1363 | } |
src/web/pages/thread.ts +6 −1
| @@ -64,7 +64,7 @@ import { | ||
| 64 | 64 | type User, |
| 65 | 65 | } from "../../core/users.ts"; |
| 66 | 66 | import type { Ctx } from "../../http/context.ts"; |
| 67 | import { commentCard } from "../comments.ts"; | |
| 67 | import { commentCard, type Refs } from "../comments.ts"; | |
| 68 | 68 | import { comeBack } from "../come_back.ts"; |
| 69 | 69 | import { backTo, field, kept, readForm, refusedHere } from "../form.ts"; |
| 70 | 70 | import { html, raw, when, type Html } from "../html.ts"; |
| @@ -383,6 +383,7 @@ export function conversation( | ||
| 383 | 383 | originAuthor: c.originAuthor, |
| 384 | 384 | originKind: glyph, |
| 385 | 385 | mark: marks.get(c.authorName), |
| 386 | refs: { base: repoBase(repo), ref: repo.defaultBranch }, | |
| 386 | 387 | question: { |
| 387 | 388 | state: c.question, |
| 388 | 389 | ...(mayAsk(c.authorId) ? { action: `${repoBase(repo)}/issues/${issue.number}/comments/${c.id}/question` } : {}), |
| @@ -470,6 +471,7 @@ export function conversation( | ||
| 470 | 471 | originAuthor: issue.originAuthor, |
| 471 | 472 | originKind: glyph, |
| 472 | 473 | originUrl: issue.originUrl, |
| 474 | refs: { base: repoBase(repo), ref: repo.defaultBranch }, | |
| 473 | 475 | }), |
| 474 | 476 | ); |
| 475 | 477 | |
| @@ -495,6 +497,7 @@ export function threadComment( | ||
| 495 | 497 | originKind?: Glyph; |
| 496 | 498 | mark?: Mark | undefined; |
| 497 | 499 | question?: { state: QuestionState | null; action?: string }; |
| 500 | refs?: Refs; | |
| 498 | 501 | } = {}, |
| 499 | 502 | ): Html { |
| 500 | 503 | // Only a question that is open or settled carries a control: an ordinary comment is not given a |
| @@ -524,6 +527,7 @@ export function threadComment( | ||
| 524 | 527 | ...(origin.originKind === undefined |
| 525 | 528 | ? {} |
| 526 | 529 | : { originKind: origin.originKind }), |
| 530 | ...(origin.refs === undefined ? {} : { refs: origin.refs }), | |
| 527 | 531 | })}${flag} |
| 528 | 532 | </div>`; |
| 529 | 533 | } |
| @@ -561,6 +565,7 @@ export function threadFragment(ctx: Ctx, kind: "issue" | "pull"): Response { | ||
| 561 | 565 | originAuthor: c.originAuthor, |
| 562 | 566 | originKind: glyph, |
| 563 | 567 | mark: marks.get(c.authorName), |
| 568 | refs: { base: repoBase(repo), ref: repo.defaultBranch }, | |
| 564 | 569 | }), |
| 565 | 570 | )}`; |
| 566 | 571 | return new Response(inlineIcons(fragment.text), { |
src/web/style/content.ts +3 −5
| @@ -803,12 +803,10 @@ img.img-box, .prose img.img-box, .tell-picture.img-box { display: block; width: | ||
| 803 | 803 | .dh .dc::before { content: ""; } |
| 804 | 804 | .nonl { color: var(--del-fg); opacity: .7; padding-left: 8px; } |
| 805 | 805 | .dl:target .dc, .dl[data-hl] .dc { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--attn) 55%, transparent); } |
| 806 | /* line-number doubles as the comment affordance */ | |
| 807 | .dn-comment { | |
| 808 | color: var(--faint); display: block; position: relative; | |
| 809 | transition: background-color 100ms var(--ease), color 100ms var(--ease); | |
| 810 | } | |
| 806 | .dn-comment { color: var(--faint); display: inline-block; } | |
| 811 | 807 | .dn-comment:hover { color: var(--accent-fg); background: var(--accent); border-radius: 4px; } |
| 808 | .dl-bar td { padding: 4px 8px; background: var(--muted); } | |
| 809 | .dl-bar span { position: sticky; left: 8px; display: inline-flex; gap: 8px; font-family: var(--font); } | |
| 812 | 810 | /* review comments ride under their line, full width */ |
| 813 | 811 | .dc-review { |
| 814 | 812 | padding: 8px 12px; background: var(--muted); |
test/changelog-depth.test.ts +2 −1
| @@ -79,7 +79,8 @@ test("from /changelog each tap reaches the next step: wave, change, pull, conver | ||
| 79 | 79 | expect(at).toBeGreaterThan(0); |
| 80 | 80 | const conversation = pullHtml.slice(at); |
| 81 | 81 | expect(conversation).toContain("opened this"); |
| 82 | expect(conversation).toMatch(/Closes #\d+/); | |
| 82 | // "Closes #N" in the body links to the issue it closes (#16423). | |
| 83 | expect(conversation).toMatch(/Closes <a href="\/alice\/shop\/issues\/\d+">#\d+<\/a>/); | |
| 83 | 84 | } finally { |
| 84 | 85 | servers.stop(); |
| 85 | 86 | app.close(); |
test/diff-edge-cases.test.ts +2 −1
| @@ -271,7 +271,8 @@ describe("diff engine + resource edge cases", () => { | ||
| 271 | 271 | |
| 272 | 272 | test("multi-hunk file: second hunk's line numbers are exactly correct (no off-by-one)", async () => { |
| 273 | 273 | // Invariant: each hunk's rows carry the line numbers from its own header. |
| 274 | const text = await (await page("multihunk")).text(); | |
| 274 | // A line's number is a link to the line (its own address); read the number it says. | |
| 275 | const text = (await (await page("multihunk")).text()).replace(/<a class="dn-comment" href="#[^"]*" title="This line's address">(\d+)<\/a>/g, "$1"); | |
| 275 | 276 | // Word-diff highlighting splits row text into per-token <span>s, so we |
| 276 | 277 | // can't search for the literal phrase; instead find each token and |
| 277 | 278 | // check the nearest preceding `<td class="dn">N</td>` line-number cell. |
test/not-found-page.test.ts +4 −3
| @@ -66,17 +66,18 @@ test("the API's 404 stays JSON", async () => { | ||
| 66 | 66 | expect(typeof ((await res.json()) as { error: unknown }).error).toBe("string"); |
| 67 | 67 | }); |
| 68 | 68 | |
| 69 | test("a signed-out visitor gets one sentence and exactly two links: home and search", async () => { | |
| 69 | test("a signed-out visitor gets one sentence, a sign-in in case it is private, and two ways on: home and search", async () => { | |
| 70 | 70 | const res = await fetch(`${servers.url}/nope/gone`); |
| 71 | 71 | const body = await res.text(); |
| 72 | 72 | expect(new TextEncoder().encode(body).length).toBeLessThan(3000); |
| 73 | 73 | expect(res.status).toBe(404); |
| 74 | 74 | const m = main(body); |
| 75 | 75 | expect(m).toContain("That page is not here."); |
| 76 | expect([...m.matchAll(/<a\s[^>]*href="([^"]*)"/g)].map((x) => x[1])).toEqual(["/", "/search"]); | |
| 76 | // The sign-in comes back to the visitor's own address, encoded in its link and nowhere else. | |
| 77 | expect([...m.matchAll(/<a\s[^>]*href="([^"]*)"/g)].map((x) => x[1])).toEqual(["/signin?next=%2Fnope%2Fgone", "/", "/search"]); | |
| 77 | 78 | expect(m).not.toContain("<form"); |
| 78 | 79 | expect(m).not.toContain("Sign in"); |
| 79 | expect(m).not.toContain("gone"); | |
| 80 | expect(m.replace("next=%2Fnope%2Fgone", "")).not.toContain("gone"); | |
| 80 | 81 | expect(res.headers.get("x-content-type-options")).toBe("nosniff"); |
| 81 | 82 | expect(res.headers.get("content-security-policy")).toContain("default-src 'none'"); |
| 82 | 83 | }); |
test/not-found-way-on.test.ts +3 −1
| @@ -55,7 +55,9 @@ test("a signed-out 404 is one sentence and two links, home and search, with the | ||
| 55 | 55 | expect(m).toContain("That page is not here."); |
| 56 | 56 | expect(m.match(/class="btn/g)?.length).toBe(2); |
| 57 | 57 | expect(m).toContain('href="/search"'); |
| 58 | expect(m).not.toContain("secret"); | |
| 58 | // The path is only in the sign-in's way back, encoded: the visitor's own address. | |
| 59 | expect(m).toContain('href="/signin?next=%2Falice%2Fsecret"'); | |
| 60 | expect(m.replace("next=%2Falice%2Fsecret", "")).not.toContain("secret"); | |
| 59 | 61 | expect(res.headers.get("x-request-id")).toMatch(/^[0-9a-f]{8}$/); |
| 60 | 62 | for (const h of ["content-security-policy", "x-content-type-options", "referrer-policy"]) expect(res.headers.get(h)).toBeTruthy(); |
| 61 | 63 | }); |
test/pinpoint-links.test.ts added +204
| @@ -0,0 +1,204 @@ | ||
| 1 | /** | |
| 2 | * Pinpointing, part two: what a person points at has an address they can get to on a phone and | |
| 3 | * copy. A comment has a Copy link beside its time; a diff line's number is the line's own address | |
| 4 | * and a line comment has an anchor, a Reply in its thread, and is where a new one lands; the Files | |
| 5 | * page jumps to the changes; `#N` and `path:line` in a comment link where they name one thing; a | |
| 6 | * shared link to a private repository answers exactly as a missing one, and a signed-out visitor | |
| 7 | * is offered sign-in on both. | |
| 8 | */ | |
| 9 | import { afterAll, beforeAll, describe, expect, test } from "bun:test"; | |
| 10 | import { mkdtemp, rm } from "node:fs/promises"; | |
| 11 | import { tmpdir } from "node:os"; | |
| 12 | import { join } from "node:path"; | |
| 13 | import { openIssue } from "../src/actions/issues.ts"; | |
| 14 | import { openPull } from "../src/actions/pulls.ts"; | |
| 15 | import { commitToBranch, createRepo, deleteRepo } from "../src/actions/repos.ts"; | |
| 16 | import { createApp, type App } from "../src/app.ts"; | |
| 17 | import { createSession } from "../src/core/sessions.ts"; | |
| 18 | import { createUser, type User } from "../src/core/users.ts"; | |
| 19 | import { serve, type Servers } from "../src/http/server.ts"; | |
| 20 | import { diffTapJs } from "../src/web/client.ts"; | |
| 21 | ||
| 22 | let dir: string; | |
| 23 | let app: App; | |
| 24 | let servers: Servers; | |
| 25 | let cookie = ""; | |
| 26 | let alice: User; | |
| 27 | const code = Array.from( | |
| 28 | { length: 40 }, | |
| 29 | (_, i) => `export const line${i + 1} = ${i + 1};`, | |
| 30 | ).join("\n"); | |
| 31 | ||
| 32 | beforeAll(async () => { | |
| 33 | dir = await mkdtemp(join(tmpdir(), "forge-pinpoint-links-")); | |
| 34 | app = createApp({ dataDir: dir, port: 0 }); | |
| 35 | servers = await serve(app); | |
| 36 | const made = await createUser(app.db, { | |
| 37 | origin: "seed", | |
| 38 | trusted: true, | |
| 39 | username: "alice", | |
| 40 | email: "[email protected]", | |
| 41 | password: "a-good-passphrase", | |
| 42 | adminIfFirst: true, | |
| 43 | }); | |
| 44 | if (!made.ok) throw new Error(made.error); | |
| 45 | alice = made.value; | |
| 46 | const repo = await createRepo(app, alice, { | |
| 47 | name: "shop", | |
| 48 | visibility: "public", | |
| 49 | }); | |
| 50 | if (!repo.ok) throw new Error(String(repo.error)); | |
| 51 | await commitToBranch(app, alice, repo.value, { | |
| 52 | message: "Start", | |
| 53 | files: [ | |
| 54 | { path: "README.md", content: "# shop\n" }, | |
| 55 | { path: "src/cart.ts", content: `${code}\n` }, | |
| 56 | ], | |
| 57 | }); | |
| 58 | await commitToBranch(app, alice, repo.value, { | |
| 59 | branch: "fix", | |
| 60 | message: "Fix", | |
| 61 | files: [ | |
| 62 | { | |
| 63 | path: "src/cart.ts", | |
| 64 | content: `${code.replace("line30 = 30", "line30 = 31")}\n`, | |
| 65 | }, | |
| 66 | { path: "README.md", content: "# shop, fixed\n" }, | |
| 67 | ], | |
| 68 | }); | |
| 69 | openIssue(app, alice, repo.value, { | |
| 70 | title: "The total is off", | |
| 71 | body: "See #2 and src/cart.ts:30, not `src/cart.ts:31`.", | |
| 72 | }); | |
| 73 | const pull = await openPull(app, alice, repo.value, { | |
| 74 | title: "Fix the total", | |
| 75 | baseBranch: "main", | |
| 76 | headBranch: "fix", | |
| 77 | }); | |
| 78 | if (!pull.ok) throw new Error(String(pull.error)); | |
| 79 | const hidden = await createRepo(app, alice, { | |
| 80 | name: "secret", | |
| 81 | visibility: "private", | |
| 82 | }); | |
| 83 | if (!hidden.ok) throw new Error(String(hidden.error)); | |
| 84 | cookie = `forge_session=${createSession(app.db, alice.id).token}`; | |
| 85 | }); | |
| 86 | ||
| 87 | afterAll(async () => { | |
| 88 | servers.stop(); | |
| 89 | app.close(); | |
| 90 | await rm(dir, { recursive: true, force: true }); | |
| 91 | }); | |
| 92 | ||
| 93 | const page = async (path: string, signedIn = true): Promise<string> => | |
| 94 | ( | |
| 95 | await fetch(`${servers.url}${path}`, { | |
| 96 | headers: signedIn ? { cookie } : {}, | |
| 97 | }) | |
| 98 | ).text(); | |
| 99 | ||
| 100 | describe("comments", () => { | |
| 101 | test("each comment's time links to it, with a Copy link beside it", async () => { | |
| 102 | const posted = await fetch( | |
| 103 | `${servers.url}/api/v1/repos/alice/shop/issues/1/comments`, | |
| 104 | { | |
| 105 | method: "POST", | |
| 106 | headers: { | |
| 107 | "content-type": "application/json", | |
| 108 | authorization: `Basic ${btoa("alice:a-good-passphrase")}`, | |
| 109 | }, | |
| 110 | body: JSON.stringify({ body: "Seen on a phone." }), | |
| 111 | }, | |
| 112 | ); | |
| 113 | const { id } = (await posted.json()) as { id: string }; | |
| 114 | const html = await page("/alice/shop/issues/1"); | |
| 115 | expect(html).toContain( | |
| 116 | `<a class="permalink" id="cl-c-${id}" href="#c-${id}"`, | |
| 117 | ); | |
| 118 | expect(html).toContain(`data-copy="cl-c-${id}"`); | |
| 119 | expect(html).toContain("Copy link"); | |
| 120 | }); | |
| 121 | ||
| 122 | test("#N and path:line in a body link to what they name; text in code does not", async () => { | |
| 123 | const html = await page("/alice/shop/issues/1"); | |
| 124 | expect(html).toContain('<a href="/alice/shop/issues/2">#2</a>'); | |
| 125 | expect(html).toContain( | |
| 126 | '<a href="/alice/shop/blob/main/src/cart.ts#L30">src/cart.ts:30</a>', | |
| 127 | ); | |
| 128 | expect(html).toContain("<code>src/cart.ts:31</code>"); | |
| 129 | }); | |
| 130 | }); | |
| 131 | ||
| 132 | describe("a pull's diff", () => { | |
| 133 | test("a line's number is its own address; the Files page lists the files, said once", async () => { | |
| 134 | const html = await page("/alice/shop/pulls/2/files"); | |
| 135 | expect(html).toMatch(/<tr class="dl" data-k="add" id="d-src-cart-ts-R30">/); | |
| 136 | expect(html).toContain( | |
| 137 | 'href="#d-src-cart-ts-R30" title="This line\'s address">30</a>', | |
| 138 | ); | |
| 139 | expect(html).not.toContain("Jump to the changes"); | |
| 140 | // On a touch screen the whole row is the target, from the page's script; the rows keep their | |
| 141 | // height. The script the page links carries it. | |
| 142 | const src = /<script src="(\/assets\/page-[0-9a-f]+\.js)"/.exec(html)?.[1]; | |
| 143 | expect(src).toBeDefined(); | |
| 144 | const js = await (await fetch(`${servers.url}${src}`)).text(); | |
| 145 | expect(js).toContain(diffTapJs); | |
| 146 | expect(diffTapJs).toContain("(pointer: coarse)"); | |
| 147 | expect(() => new Function(diffTapJs)).not.toThrow(); | |
| 148 | expect(html).toContain('id="diff"'); | |
| 149 | expect(html).toMatch(/href="#d-README-md"[^>]*>[\s\S]*?README\.md/); | |
| 150 | }); | |
| 151 | ||
| 152 | test("a new line comment lands on itself, has an anchor and a Copy link, and its thread offers Reply on the same line", async () => { | |
| 153 | const res = await fetch(`${servers.url}/alice/shop/pulls/2/review`, { | |
| 154 | method: "POST", | |
| 155 | redirect: "manual", | |
| 156 | headers: { | |
| 157 | cookie, | |
| 158 | origin: servers.url, | |
| 159 | "content-type": "application/x-www-form-urlencoded", | |
| 160 | }, | |
| 161 | body: new URLSearchParams({ | |
| 162 | path: "src/cart.ts", | |
| 163 | side: "new", | |
| 164 | line: "30", | |
| 165 | body: "Why 31?", | |
| 166 | }), | |
| 167 | }); | |
| 168 | expect(res.status).toBe(303); | |
| 169 | const at = /#rc-([0-9a-z]+)$/.exec(res.headers.get("location") ?? ""); | |
| 170 | expect(at).not.toBeNull(); | |
| 171 | const html = await page("/alice/shop/pulls/2/files"); | |
| 172 | expect(html).toContain(`<div class="comment-row" id="rc-${at![1]}">`); | |
| 173 | expect(html).toContain(`data-copy="cl-rc-${at![1]}"`); | |
| 174 | const reply = | |
| 175 | /<details class="dc-reply">[\s\S]*?<\/details>/.exec(html)?.[0] ?? ""; | |
| 176 | expect(reply).toContain('action="/alice/shop/pulls/2/review"'); | |
| 177 | expect(reply).toContain('name="line" value="30"'); | |
| 178 | expect(reply).toContain('name="side" value="new"'); | |
| 179 | }); | |
| 180 | }); | |
| 181 | ||
| 182 | describe("a link into a private repository, signed out", () => { | |
| 183 | test("answers at one address exactly as it does once the repository is gone, and the sign-in comes back to it", async () => { | |
| 184 | const made = await createRepo(app, alice, { name: "vault", visibility: "private" }); | |
| 185 | if (!made.ok) throw new Error(String(made.error)); | |
| 186 | const at = `${servers.url}/alice/vault/issues/1?tab=all`; | |
| 187 | const main = (t: string) => t.slice(t.indexOf("<main"), t.indexOf("</main>")); | |
| 188 | const hidden = await fetch(at); | |
| 189 | const gone = await deleteRepo(app, alice, made.value); | |
| 190 | if (!gone.ok) throw new Error(String(gone.error)); | |
| 191 | const missing = await fetch(at); | |
| 192 | expect([hidden.status, missing.status]).toEqual([404, 404]); | |
| 193 | const [a, b] = [main(await hidden.text()), main(await missing.text())]; | |
| 194 | expect(a).toContain(`If it's private, <a href="/signin?next=${encodeURIComponent("/alice/vault/issues/1?tab=all")}">sign in</a>.`); | |
| 195 | expect(a).toBe(b); | |
| 196 | }); | |
| 197 | ||
| 198 | test("the address it comes back to is a path on this forge, never another host", async () => { | |
| 199 | const body = await (await fetch(`${servers.url}//evil.example/x`)).text(); | |
| 200 | const next = /href="\/signin\?next=([^"]*)"/.exec(body)?.[1]; | |
| 201 | expect(next).toBeDefined(); | |
| 202 | expect(decodeURIComponent(next!)).toMatch(/^\/[^/\\]/); | |
| 203 | }); | |
| 204 | }); |
test/row-numbers.test.ts +1 −1
| @@ -170,7 +170,7 @@ describe("the list pages, rendered", () => { | ||
| 170 | 170 | const html = await page("/alice/shop/issues/1"); |
| 171 | 171 | expect(html).toContain(`id="c-${comment.id}"`); |
| 172 | 172 | expect(html).toMatch( |
| 173 | new RegExp(`<a class="permalink" href="#c-${comment.id}"`), | |
| 173 | new RegExp(`<a class="permalink" id="cl-c-${comment.id}" href="#c-${comment.id}"`), | |
| 174 | 174 | ); |
| 175 | 175 | }); |
| 176 | 176 | }); |
test/web-ui.test.ts +4 −1
| @@ -463,8 +463,11 @@ describe("web ui", () => { | ||
| 463 | 463 | const hidden = await (await fetch(`${base}/kim/secret`)).text(); |
| 464 | 464 | const absent = await (await fetch(`${base}/kim/nothing`)).text(); |
| 465 | 465 | |
| 466 | const main = (t: string) => t.slice(t.indexOf("<main"), t.indexOf("</main>")).replaceAll(/<code>[0-9a-f]{8}<\/code>/g, "<code>ID</code>"); | |
| 466 | // Each page's sign-in comes back to its own address (the only place a path is said), so the two | |
| 467 | // are compared with that way back set aside. | |
| 468 | const main = (t: string) => t.slice(t.indexOf("<main"), t.indexOf("</main>")).replaceAll(/<code>[0-9a-f]{8}<\/code>/g, "<code>ID</code>").replace(/\/signin\?next=%2Fkim%2F(?:secret|nothing)"/, '/signin?next=HERE"'); | |
| 467 | 469 | expect(main(hidden)).toBe(main(absent)); |
| 470 | expect(main(hidden)).toContain('/signin?next=HERE"'); | |
| 468 | 471 | expect(main(absent)).toContain("That page is not here."); |
| 469 | 472 | expect(main(absent)).not.toContain("secret"); |
| 470 | 473 | expect(main(absent)).not.toContain("nothing"); |
new above
offline
Design lint fails on this class:
.dl-baris not a named component. Name it in docs/design/areas/pinpoint.md (a code span is enough) and re-runbun scripts/design-lint.ts.