mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-10-18 13:50:50 +02:00
feat: expose a repository's expiration date to the explorer
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
69f9029301
commit
e524fc4588
2 files changed
+15
No files matched your search
@@ -371,6 +371,11 @@ router.get(
|
||||
sourceCommitDate: repo.model.source.commitDate,
|
||||
settingsSavedAt: repo.model.settingsSavedAt,
|
||||
publishedAt: repo.model.publishedAt,
|
||||
// Lets reviewers see how long the link stays available.
|
||||
expirationDate:
|
||||
repo.options.expirationMode !== "never"
|
||||
? repo.options.expirationDate || null
|
||||
: null,
|
||||
isAdmin: user?.isAdmin === true,
|
||||
isOwner: user?.id == repo.model.owner,
|
||||
hasWebsite: !!repo.options.page && !!repo.options.pageSource,
|
||||
|
||||
@@ -92,5 +92,15 @@ describe("repository activity dates", () => {
|
||||
expect(body.publishedAt).to.equal(undefined);
|
||||
expect(body.settingsSavedAt).to.equal(undefined);
|
||||
expect(body.lastUpdateDate).to.deep.equal(repo.model.anonymizeDate);
|
||||
expect(body.expirationDate).to.equal(null);
|
||||
});
|
||||
it("tells reviewers when an expiring repository stops being available", async () => {
|
||||
const repo = repository(); auth(repo);
|
||||
repo.model.options.expirationMode = "remove";
|
||||
repo.model.options.expirationDate = new Date("2099-01-01");
|
||||
stub(Files, "exists", async () => null);
|
||||
let body;
|
||||
await handler("repository-public", "/:repoId/options", "get")({}, { header: () => {}, json: value => { body = value; } });
|
||||
expect(body.expirationDate).to.deep.equal(new Date("2099-01-01"));
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user