mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-09-21 01:40:42 +02:00
fix: anonymize PR comment authors and bodies in previews
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"core.min.js": "core.6332b3c288.min.js",
|
"core.min.js": "core.6332b3c288.min.js",
|
||||||
"vendor.min.js": "vendor.1f3b7f76c7.min.js",
|
"vendor.min.js": "vendor.5e3fc5ef98.min.js",
|
||||||
"mermaid.min.js": "mermaid.f848a72d16.min.js",
|
"mermaid.min.js": "mermaid.f848a72d16.min.js",
|
||||||
"all.min.css": "all.99ce8f3e14.min.css"
|
"all.min.css": "all.99ce8f3e14.min.css"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2203,7 +2203,7 @@ angular
|
|||||||
if (typeof d.body === "string") out.add(d.body);
|
if (typeof d.body === "string") out.add(d.body);
|
||||||
if (typeof d.diff === "string") out.add(d.diff);
|
if (typeof d.diff === "string") out.add(d.diff);
|
||||||
const comments =
|
const comments =
|
||||||
($scope.details && $scope.details.comments) || [];
|
d.comments || [];
|
||||||
for (const c of comments) {
|
for (const c of comments) {
|
||||||
if (typeof c.author === "string") out.add(c.author);
|
if (typeof c.author === "string") out.add(c.author);
|
||||||
if (typeof c.body === "string") out.add(c.body);
|
if (typeof c.body === "string") out.add(c.body);
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -98,6 +98,18 @@ describe("frontend production regressions", function () {
|
|||||||
expect(h.routes[route].reloadOnSearch).to.equal(false);
|
expect(h.routes[route].reloadOnSearch).to.equal(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
it("includes PR comment authors and bodies in the preview batch", async function () {
|
||||||
|
const h = harness(); const pending = new Map(); let id = 0;
|
||||||
|
const timeout = fn => { pending.set(++id, fn); return id; }; timeout.cancel = id => pending.delete(id);
|
||||||
|
h.defs.anonymizeController.at(-1)(h.scope, h.http, {}, {}, {}, () => {}, timeout);
|
||||||
|
h.scope.detectedType = "pr"; h.scope.terms = "Alice";
|
||||||
|
h.scope.details = { pullRequest: { title: "title", comments: [{ author: "Alice", body: "Alice comment" }] } };
|
||||||
|
h.watches.terms(); [...pending.values()][0]();
|
||||||
|
const request = h.requests.at(-1);
|
||||||
|
expect(Array.from(request.body.contents)).to.deep.equal(["title", "Alice", "Alice comment"]);
|
||||||
|
request.resolve({ data: { contents: ["title", "MASK", "MASK comment"] } }); await h.flush();
|
||||||
|
expect(h.scope.anonymizePrContent("Alice")).to.equal("MASK");
|
||||||
|
});
|
||||||
it("finishes failed searches without letting canceled requests reset the next search", async function () {
|
it("finishes failed searches without letting canceled requests reset the next search", async function () {
|
||||||
const h = explorer(); h.scope.fileSearchQuery = "old"; h.scope.onFileSearchChange(); const old = h.requests.at(-1);
|
const h = explorer(); h.scope.fileSearchQuery = "old"; h.scope.onFileSearchChange(); const old = h.requests.at(-1);
|
||||||
h.scope.fileSearchQuery = "new"; h.scope.onFileSearchChange(); const current = h.requests.at(-1);
|
h.scope.fileSearchQuery = "new"; h.scope.onFileSearchChange(); const current = h.requests.at(-1);
|
||||||
|
|||||||
Reference in New Issue
Block a user