mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-10-20 06:37:23 +02:00
feat: refine the reviewer explorer and the visual system
- Explorer: redacted terms are highlighted in Markdown and code, the sidebar shows when the link expires, "Download repository" is the one primary action, and signed-out reviewers get a header without Sign in or the source-code link. - Status: a ready anonymization leads with a copyable share link; the support links sit flat inside their section. - One primary colour (accent) for actions and progress; mono is kept for IDs, hashes and paths; settings are plain sections instead of cards. - Font sizes snap to one scale (10-40px); rem values keep following the reader's browser font size. - Ko-fi button uses a dark surface in dark mode instead of a white pill. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e524fc4588
commit
57412d0610
14 files changed
+386
-222
No files matched your search
@@ -226,3 +226,25 @@ describe("frontend production regressions", function () {
|
||||
expect(h.scope.options.endDate.getTime()).to.be.greaterThan(h.scope.options.startDate.getTime());
|
||||
});
|
||||
});
|
||||
|
||||
describe("redaction highlighting", () => {
|
||||
const { JSDOM } = require("jsdom");
|
||||
function helpers() {
|
||||
const { window } = new JSDOM("");
|
||||
const h = harness();
|
||||
Object.assign(h.context, { DOMParser: window.DOMParser, NodeFilter: window.NodeFilter });
|
||||
return h.defs;
|
||||
}
|
||||
it("matches the mask with and without a counter", () => {
|
||||
const { redactionPattern } = helpers();
|
||||
expect("by XXXX-1 and XXXX-12 at XXXX.".match(redactionPattern("XXXX"))).to.deep.equal(["XXXX-1", "XXXX-12", "XXXX"]);
|
||||
expect("a.b-3 axb-3".match(redactionPattern("a.b"))).to.deep.equal(["a.b-3"]);
|
||||
});
|
||||
it("marks redactions in text without touching attributes", () => {
|
||||
const { highlightRedactions } = helpers();
|
||||
const html = highlightRedactions('<p>By XXXX-1 <a href="https://x.test/XXXX-2">link</a></p>', "XXXX");
|
||||
expect(html).to.include('By <mark class="redaction" title="Redacted by Anonymous GitHub">XXXX-1</mark>');
|
||||
expect(html).to.include('href="https://x.test/XXXX-2"');
|
||||
expect(highlightRedactions("<p>nothing here</p>", "XXXX")).to.equal("<p>nothing here</p>");
|
||||
});
|
||||
});
|
||||
@@ -939,6 +939,27 @@ describe("Vue 3 UI", function () {
|
||||
expect(ui.errors).to.deep.equal([]);
|
||||
});
|
||||
|
||||
it("keeps the reviewer header to the essentials and shows when the link expires", async function () {
|
||||
ui = await browser("/r/test/hello.txt", {
|
||||
"/api/repo/test/options": { anonymizedAt: "2026-01-01T00:00:00Z", expirationDate: "2099-01-01T00:00:00Z" },
|
||||
});
|
||||
const header = ui.window.document.querySelector(".navbar");
|
||||
expect(header.querySelector(".btn-signin")).to.equal(null);
|
||||
expect(header.textContent).to.include("Report a bug");
|
||||
expect(ui.window.document.querySelector(".project-expiry").textContent).to.include("Available until");
|
||||
await ui.go("/faq");
|
||||
expect(ui.window.document.querySelector(".navbar .btn-signin")).to.not.equal(null);
|
||||
expect(ui.errors).to.deep.equal([]);
|
||||
});
|
||||
|
||||
it("leads a ready status page with the copyable anonymous link", async function () {
|
||||
ui = await browser("/status/test", { "/api/repo/test": { repoId: "test", status: "ready", options: {} } });
|
||||
const input = ui.window.document.querySelector(".share-link-input");
|
||||
expect(input.value).to.match(/\/r\/test\/$/);
|
||||
expect(ui.window.document.querySelector(".paper-progress")).to.equal(null);
|
||||
expect(ui.errors).to.deep.equal([]);
|
||||
});
|
||||
|
||||
for (const [code, message] of [["repo_not_found", "The repository was not found"], ["untranslated_failure", "Unknown error, contact the admin."]]) {
|
||||
it("shows the " + code + " explorer error in a card without file actions", async function () {
|
||||
ui = await browser("/r/gone/", { "/api/repo/gone/options": { __status: 404, body: { error: code } } });
|
||||
|
||||
Reference in new issue
Block a user