mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-12-02 09:03:37 +01:00
- Commit messages lose sign-off and co-author trailers, e-mail addresses and the fork owner in merge headlines; without the origin option merge headlines lose branch names too. - Branch names are shown only with the origin option. - Gists keep only images (hidden unless images are displayed); other binaries are never stored or served. Images share an 8 MB budget so the gist document stays under MongoDB's limit, and an unreadable image no longer fails the whole gist. - Review threads match the diff side, and outdated comments go to the end of their file instead of an unrelated line. - The diff parser no longer reads a removed '-- ' line as a file header. - Each diff file renders as its own component from escaped HTML, so large diffs don't re-render on scroll or collapse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
132 lines
17 KiB
HTML
132 lines
17 KiB
HTML
<div class="pr-page review-page">
|
||
<div class="container paper-page pr-page-inner">
|
||
<div class="paper-crumbs">
|
||
<a href="/dashboard">Reviewer</a> /
|
||
<span class="here">Pull request</span>
|
||
</div>
|
||
|
||
<header class="pr-header">
|
||
<div class="pr-title-row">
|
||
<h1 class="paper-page-title pr-title">
|
||
<span v-if="details?.title"><template v-for="(seg, si) in redactParts(details.title)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span>
|
||
<span class="text-muted" v-if="details && !details?.title">Untitled pull request</span>
|
||
</h1>
|
||
<a class="btn btn-sm" aria-label="Edit" v-if="options?.isAdmin || options?.isOwner" :href="safeUrl("/pull-request-anonymize/" + (pullRequestId))"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-edit"></use></svg><span class="d-none d-md-inline"> Edit</span></a>
|
||
</div>
|
||
<div class="pr-state-line" v-if="details">
|
||
<span class="pr-state" :class="'is-' + prState()"><svg class="ui-icon" aria-hidden="true"><use :href="prState() === 'merged' ? '#ui-icon-branch' : prState() === 'closed' ? '#project-icon-close' : '#project-type-pr'"></use></svg>{{ prStateLabel() }}</span>
|
||
<p class="pr-summary">
|
||
<span class="pr-author pr-summary-author" :class="{ 'is-redacted': isRedactedName(details.author) }" v-if="details?.author"><template v-if="!isRedactedName(details.author)">@</template><template v-for="(seg, si) in redactParts(details.author)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><span class="pr-summary-author is-hidden" v-else>The author</span>
|
||
{{ prState() === 'merged' ? ' merged' : ' wants to merge' }}
|
||
<template v-if="details?.commits?.length"> {{ fmt.plural(details.commits.length, {'one': '1 commit', 'other': '{} commits'}) }}</template>
|
||
<template v-if="details?.baseRef"> into <code class="pr-branch"><template v-for="(seg, si) in redactParts(details.baseRef)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></code></template>
|
||
<template v-if="details?.headRef"> from <code class="pr-branch"><template v-for="(seg, si) in redactParts(details.headRef)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></code></template>
|
||
</p>
|
||
</div>
|
||
<div class="pr-header-meta" v-if="details">
|
||
<span class="pr-meta-item" v-if="details?.baseRepositoryFullName"><i class="fab fa-github"></i> <span v-text="details?.baseRepositoryFullName"></span></span>
|
||
<span class="pr-meta-item" v-if="details?.creationDate"><svg class="ui-icon" aria-hidden="true"><use href="#project-icon-clock"></use></svg> Opened {{ fmt?.date(details.creationDate) }}</span>
|
||
<span class="pr-meta-item" v-if="details?.mergedDate && details?.merged">Merged {{ fmt?.date(details.mergedDate) }}</span>
|
||
<span class="pr-meta-item" v-else-if="details?.updatedDate">Updated {{ fmt?.date(details.updatedDate) }}</span>
|
||
<span class="pr-meta-item" v-if="details?.anonymizeDate"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-shield"></use></svg> Anonymized {{ fmt?.date(details.anonymizeDate) }}</span>
|
||
</div>
|
||
</header>
|
||
|
||
<nav class="paper-tabs pr-tabs" role="tablist" aria-label="Pull request" v-if="details">
|
||
<button class="paper-tab" type="button" role="tab" :class="{ active: tabState?.active == 'conversation' }" id="pr-conversation-tab" :aria-selected="tabState?.active === 'conversation'" aria-controls="pr-conversation-panel" :tabindex="tabState?.active === 'conversation' ? 0 : -1" @keydown="previewTabKeydown($event)" @click="openTab('conversation')">
|
||
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-comment"></use></svg>Conversation<span class="tab-count" v-if="conversationCount()">{{ conversationCount() }}</span>
|
||
</button>
|
||
<button class="paper-tab" type="button" role="tab" v-if="details?.commits?.length" :class="{ active: tabState?.active == 'commits' }" id="pr-commits-tab" :aria-selected="tabState?.active === 'commits'" aria-controls="pr-commits-panel" :tabindex="tabState?.active === 'commits' ? 0 : -1" @keydown="previewTabKeydown($event)" @click="openTab('commits')">
|
||
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-commit"></use></svg>Commits<span class="tab-count">{{ details.commits.length }}</span>
|
||
</button>
|
||
<button class="paper-tab" type="button" role="tab" v-if="details?.diff" :class="{ active: tabState?.active == 'files' }" id="pr-files-tab" :aria-selected="tabState?.active === 'files'" aria-controls="pr-files-panel" :tabindex="tabState?.active === 'files' ? 0 : -1" @keydown="previewTabKeydown($event)" @click="openTab('files')">
|
||
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-code"></use></svg><span>Files<span class="tab-long"> changed</span></span><span class="tab-count">{{ prStats().files }}</span>
|
||
</button>
|
||
<span class="pr-tabs-stat" v-if="details?.diff" :aria-label="prStats().additions + ' additions, ' + prStats().deletions + ' deletions'"><span class="stat-add">+{{ fmt.number(prStats().additions) }}</span><span class="stat-del">−{{ fmt.number(prStats().deletions) }}</span></span>
|
||
</nav>
|
||
|
||
<div class="paper-tab-content">
|
||
<div role="tabpanel" id="pr-conversation-panel" aria-labelledby="pr-conversation-tab" v-if="details && tabState?.active == 'conversation'">
|
||
<ol class="pr-timeline">
|
||
<li class="pr-timeline-item is-description">
|
||
<div class="pr-thread">
|
||
<article class="pr-thread-comment">
|
||
<header class="pr-thread-head">
|
||
<span class="pr-avatar" aria-hidden="true"><svg class="ui-icon"><use href="#ui-icon-user"></use></svg></span>
|
||
<span class="pr-author" :class="{ 'is-redacted': isRedactedName(details.author) }" v-if="details?.author"><template v-if="!isRedactedName(details.author)">@</template><template v-for="(seg, si) in redactParts(details.author)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><span class="pr-author is-hidden" v-else>Author</span>
|
||
<span class="pr-comment-action">opened this pull request</span>
|
||
<time class="pr-thread-date" v-if="details?.creationDate">{{ fmt?.date(details.creationDate) }}</time>
|
||
</header>
|
||
<div class="pr-thread-body" v-if="details?.body"><markdown :content="details.body" :reader="true"></markdown></div>
|
||
<p class="pr-thread-body text-muted" v-else>No description.</p>
|
||
</article>
|
||
</div>
|
||
</li>
|
||
<li class="pr-timeline-item" v-for="item in prTimeline()" :key="item.key" :class="'is-' + item.kind">
|
||
<div class="pr-review-head" v-if="item.kind === 'review'">
|
||
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-code"></use></svg>
|
||
<span>Review on <button type="button" class="pr-review-file" v-if="item.file" @click="showInDiff(item.file)"><template v-for="(seg, si) in redactParts(item.thread.path)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></button><code v-else><template v-for="(seg, si) in redactParts(item.thread.path)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></code><template v-if="item.thread.line"> · line {{ item.thread.line }}</template></span>
|
||
</div>
|
||
<pr-thread :comments="item.comments" :fmt="fmt"></pr-thread>
|
||
</li>
|
||
</ol>
|
||
</div>
|
||
|
||
<div role="tabpanel" id="pr-commits-panel" aria-labelledby="pr-commits-tab" v-if="details?.commits?.length && tabState?.active == 'commits'">
|
||
<section class="pr-commit-group" v-for="(group, gi) in commitGroups()" :key="gi">
|
||
<h2 class="pr-commit-day" v-if="group.day"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-commit"></use></svg>Commits on {{ group.day }}</h2>
|
||
<ol class="pr-commit-list">
|
||
<li class="pr-commit" v-for="commit in group.commits" :key="commit.index">
|
||
<span class="pr-commit-index" :aria-label="'Commit ' + commit.index">{{ commit.index }}</span>
|
||
<div class="pr-commit-text">
|
||
<p class="pr-commit-headline"><template v-for="(seg, si) in redactParts(commit.headline)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></p>
|
||
<p class="pr-commit-detail" v-if="commit.detail"><template v-for="(seg, si) in redactParts(commit.detail)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></p>
|
||
</div>
|
||
<span class="pr-author pr-commit-author" :class="{ 'is-redacted': isRedactedName(commit.author) }" v-if="commit.author"><template v-if="!isRedactedName(commit.author)">@</template><template v-for="(seg, si) in redactParts(commit.author)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span>
|
||
</li>
|
||
</ol>
|
||
</section>
|
||
</div>
|
||
|
||
<div role="tabpanel" id="pr-files-panel" aria-labelledby="pr-files-tab" v-if="details?.diff && tabState?.active == 'files'">
|
||
<div class="toc-layout is-left" :class="{ 'has-toc': showFileToc() }">
|
||
<aside class="page-toc pr-file-toc" v-if="showFileToc()" aria-label="Changed files">
|
||
<div class="page-toc-head">{{ fmt.plural(prStats().files, {'one': '1 file changed', 'other': '{} files changed'}) }}</div>
|
||
<nav class="toc-rail"><a v-for="f in prFiles()" :key="f.id" :href="'#' + f.id" class="toc-file toc-diff-file" :class="{ 'is-active': activeFileIndex() === f.index }" :aria-current="activeFileIndex() === f.index ? 'location' : null" @click.prevent="jumpToFile(f)"><span class="diff-status-dot" :class="'is-' + f.status" :title="fmt.title(f.status)"><span class="sr-only">{{ f.status }}</span></span><span class="toc-file-name"><span class="toc-file-dir" v-if="f.dir"><template v-for="(seg, si) in redactParts(f.dir)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><template v-for="(seg, si) in redactParts(f.name)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><span class="toc-file-stat"><span class="stat-add" v-if="f.additions">+{{ f.additions }}</span><span class="stat-del" v-if="f.deletions">−{{ f.deletions }}</span></span></a></nav>
|
||
</aside>
|
||
<div class="toc-main">
|
||
<div class="toc-bar pr-files-bar">
|
||
<div class="toc-menu" v-if="showFileToc()">
|
||
<button type="button" class="btn btn-sm btn-ghost toc-menu-btn" :class="{ 'is-on': tocOpen }" aria-haspopup="true" :aria-expanded="tocOpen ? 'true' : 'false'" @click.stop="tocOpen = !tocOpen"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-outline"></use></svg><span class="toc-menu-label">{{ fmt.plural(prStats().files, {'one': '1 file', 'other': '{} files'}) }}</span><span class="toc-menu-current" v-if="prFiles()[activeFileIndex()]"><template v-for="(seg, si) in redactParts(prFiles()[activeFileIndex()].name)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><svg class="ui-icon toc-menu-chevron" aria-hidden="true"><use href="#ui-icon-chevron-down"></use></svg></button>
|
||
<nav class="toc-menu-pop toc-rail" v-if="tocOpen" aria-label="Changed files"><a v-for="f in prFiles()" :key="f.id" :href="'#' + f.id" class="toc-file toc-diff-file" :class="{ 'is-active': activeFileIndex() === f.index }" :aria-current="activeFileIndex() === f.index ? 'location' : null" @click.prevent="jumpToFile(f)"><span class="diff-status-dot" :class="'is-' + f.status" :title="fmt.title(f.status)"><span class="sr-only">{{ f.status }}</span></span><span class="toc-file-name"><span class="toc-file-dir" v-if="f.dir"><template v-for="(seg, si) in redactParts(f.dir)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><template v-for="(seg, si) in redactParts(f.name)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><span class="toc-file-stat"><span class="stat-add" v-if="f.additions">+{{ f.additions }}</span><span class="stat-del" v-if="f.deletions">−{{ f.deletions }}</span></span></a></nav>
|
||
</div>
|
||
<span class="pr-files-summary">{{ fmt.plural(prStats().files, {'one': '1 file changed', 'other': '{} files changed'}) }}<span class="stat-add">+{{ fmt.number(prStats().additions) }}</span><span class="stat-del">−{{ fmt.number(prStats().deletions) }}</span></span>
|
||
<button type="button" class="btn btn-sm btn-ghost pr-collapse-all" @click="toggleAllFiles()">{{ allCollapsed() ? 'Expand all' : 'Collapse all' }}</button>
|
||
</div>
|
||
<section class="diff-file-block" v-for="file in prFiles()" :key="file.id" :id="file.id" :class="{ 'is-collapsed': collapsedFiles[file.index] }" :aria-label="file.path">
|
||
<header class="diff-file-header">
|
||
<button type="button" class="diff-file-toggle" :aria-expanded="collapsedFiles[file.index] ? 'false' : 'true'" :aria-controls="file.id + '-body'" :aria-label="(collapsedFiles[file.index] ? 'Expand ' : 'Collapse ') + file.path" @click="toggleFile(file.index)"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-chevron-down"></use></svg></button>
|
||
<span class="diff-file-name" :title="file.path"><span class="diff-file-dir" v-if="file.dir"><template v-for="(seg, si) in redactParts(file.dir)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><template v-for="(seg, si) in redactParts(file.name)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span>
|
||
<span class="diff-file-meta">
|
||
<span class="diff-file-status" :class="'diff-file-status-' + file.status" v-if="file.status !== 'modified'">{{ file.status }}</span>
|
||
<span class="diff-file-threads" v-if="file.threads" :title="fmt.plural(file.threads, {'one': '1 review thread', 'other': '{} review threads'})"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-comment"></use></svg>{{ file.threads }}</span>
|
||
<span class="diff-file-stat" :aria-label="file.additions + ' additions, ' + file.deletions + ' deletions'"><span class="stat-add" v-if="file.additions">+{{ file.additions }}</span><span class="stat-del" v-if="file.deletions">−{{ file.deletions }}</span><span class="diff-bar" aria-hidden="true"><i v-for="(b, bi) in diffBar(file)" :key="bi" :class="'is-' + b"></i></span></span>
|
||
</span>
|
||
</header>
|
||
<div class="diff-file-body" :id="file.id + '-body'" v-if="!collapsedFiles[file.index]">
|
||
<diff-table :file="file" :fmt="fmt"></diff-table>
|
||
<div class="diff-loose-threads" v-if="file.looseThreads.length">
|
||
<div class="diff-loose-thread" v-for="(thread, ti) in file.looseThreads" :key="ti">
|
||
<div class="pr-review-head"><span>Comment on line {{ thread.line || '—' }} (outside this diff)</span></div>
|
||
<pr-thread :comments="thread.comments" :fmt="fmt"></pr-thread>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|