mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-15 06:30:26 +02:00
feat: gist & co-authors
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
<div class="paper-crumbs">My work / <span class="here">New anonymization</span></div>
|
||||
<h1 class="paper-page-title">New <em>anonymization</em></h1>
|
||||
<p class="paper-page-lede">
|
||||
Paste a GitHub repository or pull-request URL. We’ll fetch it,
|
||||
strip every trace of identity, and hand you back a stable link.
|
||||
Paste a GitHub repository, pull-request, or gist URL. We’ll fetch
|
||||
it, strip every trace of identity, and hand you back a stable link.
|
||||
</p>
|
||||
<div class="form-group mt-4 mb-2">
|
||||
<label class="paper-field-label" for="sourceUrl-landing">Source URL</label>
|
||||
@@ -15,13 +15,13 @@
|
||||
type="text"
|
||||
class="form-control form-control-lg"
|
||||
ng-model="sourceUrl"
|
||||
placeholder="https://github.com/owner/repo or https://github.com/owner/repo/pull/42"
|
||||
placeholder="https://github.com/owner/repo, https://github.com/owner/repo/pull/42, or https://gist.github.com/owner/abcdef…"
|
||||
ng-model-options="{ debounce: {default: 1000, blur: 0, click: 0}, updateOn: 'default blur click' }"
|
||||
ng-change="urlSelected()"
|
||||
/>
|
||||
</div>
|
||||
<small class="form-text" style="color: var(--ink-muted);">
|
||||
Paste a repository URL to anonymize a repo, or a pull-request URL to anonymize a PR.
|
||||
Paste a repository URL to anonymize a repo, a pull-request URL for a PR, or a gist URL for a gist.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
@@ -39,8 +39,8 @@
|
||||
<span ng-if="!isUpdate">New <em>anonymization</em></span>
|
||||
<span ng-if="isUpdate">Edit <em>anonymization</em></span>
|
||||
</h1>
|
||||
<span class="type-badge" ng-show="detectedType" ng-class="{'type-repo': detectedType === 'repo', 'type-pr': detectedType === 'pr'}">
|
||||
{{detectedType === 'repo' ? 'Repo' : 'PR'}}
|
||||
<span class="type-badge" ng-show="detectedType" ng-class="{'type-repo': detectedType === 'repo', 'type-pr': detectedType === 'pr', 'type-gist': detectedType === 'gist'}">
|
||||
{{detectedType === 'repo' ? 'Repo' : detectedType === 'pr' ? 'PR' : 'Gist'}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -131,6 +131,14 @@
|
||||
<div class="invalid-feedback" ng-show="anonymize.pullRequestId.$error.used">{{pullRequestId}} is already used.</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" ng-show="detectedType === 'gist'">
|
||||
<label class="paper-field-label" for="gistId">Anonymized gist ID</label>
|
||||
<input type="text" class="form-control" name="gistId" id="gistId" ng-class="{'is-invalid': anonymize.gistId.$invalid}" ng-model="gistId" ng-model-options="{ debounce: {default: 1000, blur: 0, click: 0}, updateOn: 'default blur click' }" />
|
||||
<small class="form-text text-muted">Your share link will be <code>anonymous.4open.science/gist/{{gistId}}</code>.</small>
|
||||
<div class="invalid-feedback" ng-show="anonymize.gistId.$error.format">ID can only contain letters and numbers.</div>
|
||||
<div class="invalid-feedback" ng-show="anonymize.gistId.$error.used">{{gistId}} is already used.</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="paper-field-label" for="conference">Conference <span class="paper-optional">(optional)</span></label>
|
||||
<input class="form-control" id="conference" name="conference" ng-model="conference" ng-class="{'is-invalid': anonymize.conference.$invalid}" />
|
||||
@@ -186,6 +194,33 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="detectedType === 'gist'">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="title-gist" name="title-gist" ng-model="options.title" />
|
||||
<label class="form-check-label" for="title-gist">Gist description</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="content-gist" name="content-gist" ng-model="options.content" />
|
||||
<label class="form-check-label" for="content-gist">File contents</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="comments-gist" name="comments-gist" ng-model="options.comments" />
|
||||
<label class="form-check-label" for="comments-gist">Comments</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="username-gist" name="username-gist" ng-model="options.username" />
|
||||
<label class="form-check-label" for="username-gist">Usernames</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="date-gist" name="date-gist" ng-model="options.date" />
|
||||
<label class="form-check-label" for="date-gist">Dates</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="origin-gist" name="origin-gist" ng-model="options.origin" />
|
||||
<label class="form-check-label" for="origin-gist">Source gist ID</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="detectedType === 'pr'">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="title" name="title" ng-model="options.title" />
|
||||
@@ -239,6 +274,50 @@
|
||||
<small class="form-text text-muted" ng-show="options.expirationMode=='redirect'">After {{options.expirationDate | date}}, visitors will be redirected to GitHub.</small>
|
||||
</section>
|
||||
|
||||
<section class="paper-settings-section" ng-show="isUpdate && detectedType === 'repo'">
|
||||
<div class="paper-section-eyebrow">Co-authors</div>
|
||||
<p class="form-text text-muted" style="margin-bottom: 8px;">
|
||||
Co-authors can view and edit these settings. They cannot delete the anonymization or manage co-authors.
|
||||
</p>
|
||||
|
||||
<div class="form-group" ng-show="role === 'owner' || role === 'admin'">
|
||||
<label class="paper-field-label" for="coauthorSearch">Add a GitHub user</label>
|
||||
<div style="position: relative;">
|
||||
<input
|
||||
type="text"
|
||||
id="coauthorSearch"
|
||||
class="form-control"
|
||||
placeholder="Search GitHub username…"
|
||||
ng-model="coauthorSearch"
|
||||
ng-change="searchCoauthors()"
|
||||
ng-model-options="{ debounce: 300 }"
|
||||
autocomplete="off"
|
||||
/>
|
||||
<div class="dropdown-menu show" style="display: block; max-height: 220px; overflow-y: auto; width: 100%;" ng-show="coauthorResults.length > 0">
|
||||
<a href="#" class="dropdown-item d-flex align-items-center" ng-repeat="u in coauthorResults" ng-click="addCoauthor(u, $event)">
|
||||
<img ng-src="{{u.photo}}" alt="" style="width: 22px; height: 22px; border-radius: 50%; margin-right: 8px;" />
|
||||
<span ng-bind="u.username"></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<small class="form-text text-muted" ng-show="coauthorError" ng-bind="coauthorError"></small>
|
||||
</div>
|
||||
|
||||
<div class="coauthor-list">
|
||||
<div class="coauthor-row d-flex align-items-center" ng-repeat="c in coauthors" style="padding: 6px 0; gap: 8px;">
|
||||
<img ng-src="{{c.photo}}" alt="" style="width: 24px; height: 24px; border-radius: 50%;" ng-if="c.photo" />
|
||||
<a ng-href="https://github.com/{{c.username}}" target="_blank" ng-bind="c.username"></a>
|
||||
<span class="type-badge type-coauthor">Co-author</span>
|
||||
<button type="button" class="btn btn-sm" ng-click="removeCoauthor(c)" ng-show="role === 'owner' || role === 'admin'" style="margin-left: auto;" title="Remove co-author">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="form-text text-muted" ng-show="!coauthors || coauthors.length === 0">
|
||||
No co-authors yet.
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="alert alert-danger" role="alert" ng-if="error" ng-bind="error"></div>
|
||||
|
||||
<div class="anonymize-submit-bar" ng-show="detectedType">
|
||||
@@ -254,6 +333,12 @@
|
||||
<button type="submit" class="btn btn-ink" ng-click="anonymizePullRequest($event)" ng-if="detectedType === 'pr' && isUpdate">
|
||||
<i class="fas fa-save mr-1"></i> Update Pull Request
|
||||
</button>
|
||||
<button type="submit" class="btn btn-ink" ng-click="anonymizeGist($event)" ng-if="detectedType === 'gist' && !isUpdate">
|
||||
<i class="fas fa-user-secret mr-1"></i> Anonymize Gist
|
||||
</button>
|
||||
<button type="submit" class="btn btn-ink" ng-click="anonymizeGist($event)" ng-if="detectedType === 'gist' && isUpdate">
|
||||
<i class="fas fa-save mr-1"></i> Update Gist
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -270,6 +355,51 @@
|
||||
<div class="anonymize-preview-body markdown-body body" ng-bind-html="html_readme"></div>
|
||||
</div>
|
||||
|
||||
<div class="anonymize-preview-col" ng-if="detectedType === 'gist' && details">
|
||||
<div class="anonymize-preview-head">
|
||||
<span class="paper-eyebrow">Live preview</span>
|
||||
<span class="anonymize-preview-sub">Gist with redactions applied</span>
|
||||
</div>
|
||||
<div class="anonymize-preview-body">
|
||||
<div class="d-flex w-100 justify-content-between align-items-center flex-wrap">
|
||||
<h2 class="pr-title mb-1">
|
||||
<span ng-if="options.title">{{anonymizeGistContent(details.gist.description) || 'Untitled gist'}}</span>
|
||||
<span class="badge" ng-class="{'badge-success': details.gist.isPublic, 'badge-secondary': !details.gist.isPublic}">
|
||||
{{details.gist.isPublic ? 'public' : 'secret'}}
|
||||
</span>
|
||||
</h2>
|
||||
<small ng-bind="details.gist.updatedDate | date" ng-if="options.date"></small>
|
||||
</div>
|
||||
<small ng-if="options.origin">Gist ID: {{details.source.gistId}}</small>
|
||||
<small ng-if="options.username && details.gist.ownerLogin">By @{{anonymizeGistContent(details.gist.ownerLogin)}}</small>
|
||||
<ul class="pr-comments mt-3">
|
||||
<li class="pr-comment" ng-repeat="file in details.gist.files" ng-if="options.content">
|
||||
<div class="pr-comment-head">
|
||||
<strong ng-bind="anonymizeGistContent(file.filename)"></strong>
|
||||
<span class="pr-comment-date" ng-if="file.language">{{file.language}}</span>
|
||||
</div>
|
||||
<pre class="pr-diff"><code ng-bind="anonymizeGistContent(file.content)"></code></pre>
|
||||
</li>
|
||||
</ul>
|
||||
<div ng-if="options.comments && details.gist.comments && details.gist.comments.length">
|
||||
<h3 class="paper-section-eyebrow mt-3">Comments</h3>
|
||||
<ul class="pr-comments">
|
||||
<li class="pr-comment" ng-repeat="comment in details.gist.comments">
|
||||
<div class="pr-comment-head">
|
||||
<span class="pr-comment-author" ng-if="options.username">
|
||||
<i class="far fa-user"></i> @<span ng-bind="anonymizeGistContent(comment.author)"></span>
|
||||
</span>
|
||||
<span class="pr-comment-date" ng-if="options.date" ng-bind="comment.updatedDate | date"></span>
|
||||
</div>
|
||||
<div class="pr-comment-body" ng-if="options.body">
|
||||
<markdown content="anonymizeGistContent(comment.body)" options="options" terms="terms"></markdown>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="anonymize-preview-col" ng-if="detectedType === 'pr' && details"
|
||||
ng-init="prTabState = { active: options.diff ? 'diff' : 'comments' }">
|
||||
<div class="anonymize-preview-head">
|
||||
|
||||
@@ -86,6 +86,7 @@
|
||||
<button type="button" class="btn" ng-class="{'btn-primary': typeFilter === 'all'}" ng-click="typeFilter = 'all'">All</button>
|
||||
<button type="button" class="btn" ng-class="{'btn-primary': typeFilter === 'repo'}" ng-click="typeFilter = 'repo'">Repos</button>
|
||||
<button type="button" class="btn" ng-class="{'btn-primary': typeFilter === 'pr'}" ng-click="typeFilter = 'pr'">PRs</button>
|
||||
<button type="button" class="btn" ng-class="{'btn-primary': typeFilter === 'gist'}" ng-click="typeFilter = 'gist'">Gists</button>
|
||||
</div>
|
||||
|
||||
<div class="dropdown">
|
||||
@@ -182,12 +183,14 @@
|
||||
ng-repeat="item in items | filter:itemFilter | orderBy:orderBy as filteredItems"
|
||||
>
|
||||
<div class="cell-anon" role="cell">
|
||||
<span class="type-badge" ng-class="{'type-repo': item._type === 'repo', 'type-pr': item._type === 'pr'}">{{item._type === 'repo' ? 'Repo' : 'PR'}}</span>
|
||||
<span class="type-badge" ng-class="{'type-repo': item._type === 'repo', 'type-pr': item._type === 'pr', 'type-gist': item._type === 'gist'}">{{item._type === 'repo' ? 'Repo' : item._type === 'pr' ? 'PR' : 'Gist'}}</span>
|
||||
<span class="type-badge type-coauthor" ng-if="item.role === 'coauthor'" title="You are a co-author on this anonymization">Co-author</span>
|
||||
<div class="anon-text">
|
||||
<a ng-href="{{item._viewUrl}}" class="repo-name" ng-bind="item._name"></a>
|
||||
<div class="anon-sub">
|
||||
<a ng-if="item._type === 'repo'" href="https://github.com/{{item.source.fullName}}/" ng-bind="item.source.fullName"></a><span ng-if="item._type === 'repo' && item.options.update"> · <a href="https://github.com/{{item.source.fullName}}/tree/{{item.source.branch}}" ng-bind="item.source.branch"></a><span ng-if="item.source.commit"> · @<a href="https://github.com/{{item.source.fullName}}/tree/{{item.source.commit}}" ng-bind="item.source.commit.substring(0, 8)"></a></span></span><span ng-if="item._type === 'repo' && !item.options.update"> · @<a href="https://github.com/{{item.source.fullName}}/tree/{{item.source.commit}}" ng-bind="item.source.commit.substring(0, 8)"></a></span>
|
||||
<a ng-if="item._type === 'pr'" href="https://github.com/{{item.source.repositoryFullName}}/pull/{{item.source.pullRequestId}}" ng-bind="item._source"></a>
|
||||
<a ng-if="item._type === 'gist'" href="https://gist.github.com/{{item.source.gistId}}" ng-bind="item._source"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -232,7 +235,7 @@
|
||||
<a class="dropdown-item" href="#" ng-show="item.status == 'removed'" ng-click="refreshItem(item)">
|
||||
<i class="fas fa-check-circle"></i> Enable
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" ng-show="item.status == 'ready' || item.status == 'expired' || item.status == 'error'" ng-click="removeItem(item)">
|
||||
<a class="dropdown-item" href="#" ng-show="(item.status == 'ready' || item.status == 'expired' || item.status == 'error') && item.role !== 'coauthor'" ng-click="removeItem(item)">
|
||||
<i class="fas fa-trash-alt"></i> Remove
|
||||
</a>
|
||||
<a class="dropdown-item" ng-href="{{item._viewUrl}}">
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
<div class="pr-page" ng-init="tabState = { active: (details && details.files) ? 'files' : 'comments' }">
|
||||
<div class="container paper-page pr-page-inner">
|
||||
<div class="paper-crumbs">
|
||||
<a href="/dashboard">Reviewer</a> /
|
||||
<span class="here">Gist</span>
|
||||
</div>
|
||||
|
||||
<header class="pr-header">
|
||||
<h1 class="paper-page-title pr-title">
|
||||
<span ng-if="details.description" ng-bind="details.description"></span>
|
||||
<span ng-if="!details.description" class="text-muted">Untitled gist</span>
|
||||
</h1>
|
||||
<div class="pr-header-meta">
|
||||
<span class="paper-pill" ng-class="{'good': details.isPublic, 'warn': !details.isPublic}">
|
||||
{{ details.isPublic ? 'Public' : 'Secret' }}
|
||||
</span>
|
||||
<span class="pr-meta-item" ng-if="details.ownerLogin">
|
||||
<i class="far fa-user"></i> @<span ng-bind="details.ownerLogin"></span>
|
||||
</span>
|
||||
<span class="pr-meta-item" ng-if="details.updatedDate">
|
||||
<i class="far fa-clock"></i> <span ng-bind="details.updatedDate | date"></span>
|
||||
</span>
|
||||
<span class="pr-meta-item" ng-if="details.anonymizeDate">
|
||||
<i class="fas fa-user-secret"></i> Anonymized <span ng-bind="details.anonymizeDate | date"></span>
|
||||
</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<nav class="paper-tabs" ng-if="details.files || details.comments" role="tablist">
|
||||
<button
|
||||
class="paper-tab"
|
||||
ng-if="details.files"
|
||||
ng-class="{'active': tabState.active == 'files'}"
|
||||
ng-click="tabState.active = 'files'"
|
||||
type="button"
|
||||
role="tab"
|
||||
>
|
||||
<i class="fas fa-file-code"></i>
|
||||
<ng-pluralize
|
||||
count="details.files.length"
|
||||
when="{'0': 'No files', 'one': '1 file', 'other': '{} files'}"
|
||||
></ng-pluralize>
|
||||
</button>
|
||||
<button
|
||||
class="paper-tab"
|
||||
ng-if="details.comments"
|
||||
ng-class="{'active': tabState.active == 'comments'}"
|
||||
ng-click="tabState.active = 'comments'"
|
||||
type="button"
|
||||
role="tab"
|
||||
>
|
||||
<i class="far fa-comment-dots"></i>
|
||||
<ng-pluralize
|
||||
count="details.comments.length"
|
||||
when="{'0': 'No comments', 'one': '1 comment', 'other': '{} comments'}"
|
||||
></ng-pluralize>
|
||||
</button>
|
||||
</nav>
|
||||
|
||||
<div class="paper-tab-content">
|
||||
<div ng-if="details.files && tabState.active =='files'">
|
||||
<ul class="pr-comments">
|
||||
<li class="pr-comment" ng-repeat="file in details.files">
|
||||
<div class="pr-comment-head">
|
||||
<strong ng-bind="file.filename"></strong>
|
||||
<span class="pr-comment-date" ng-if="file.language">{{file.language}}</span>
|
||||
</div>
|
||||
<pre class="pr-diff"><code ng-bind="file.content"></code></pre>
|
||||
</li>
|
||||
<li class="paper-table-empty" ng-if="!details.files.length">
|
||||
<i class="fas fa-file"></i>
|
||||
<span>No files in this gist.</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div ng-if="details.comments && tabState.active =='comments'">
|
||||
<ul class="pr-comments">
|
||||
<li class="pr-comment" ng-repeat="comment in details.comments">
|
||||
<div class="pr-comment-head">
|
||||
<span class="pr-comment-author" ng-if="comment.author">
|
||||
<i class="far fa-user"></i> @<span ng-bind="comment.author"></span>
|
||||
</span>
|
||||
<span class="pr-comment-date" ng-if="comment.updatedDate" ng-bind="comment.updatedDate | date"></span>
|
||||
</div>
|
||||
<div class="pr-comment-body" ng-if="comment.body">
|
||||
<markdown content="comment.body"></markdown>
|
||||
</div>
|
||||
</li>
|
||||
<li class="paper-table-empty" ng-if="!details.comments.length">
|
||||
<i class="far fa-comment-dots"></i>
|
||||
<span>No comments on this gist.</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user