From e524fc45883477db0d95f8a204dc4896617724b9 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Thu, 8 Oct 2026 12:53:39 +0200 Subject: [PATCH] feat: expose a repository's expiration date to the explorer Co-Authored-By: Claude Opus 5.5 (1M context) --- src/server/routes/repository-public.ts | 5 +++++ test/repository-activity.test.js | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/server/routes/repository-public.ts b/src/server/routes/repository-public.ts index 9150bd3..371f09e 100644 --- a/src/server/routes/repository-public.ts +++ b/src/server/routes/repository-public.ts @@ -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, diff --git a/test/repository-activity.test.js b/test/repository-activity.test.js index 75d52d6..806e31d 100644 --- a/test/repository-activity.test.js +++ b/test/repository-activity.test.js @@ -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")); }); });