Keep shared Rule files reachable, and say when a privacy change does not save.

This commit is contained in:
adilallo committed 2026-11-09 20:05:06 -07:00
1 parent b6795c1f18
commit 63ba21c614
9 files changed
+148 -16

No files matched your search

+21
View File
@@ -153,6 +153,27 @@ describe("getReadablePublishedRule", () => {
).toBeNull();
});
it("lets anonymous readers of a shared Rule through when the caller already has the id", async () => {
isDatabaseConfiguredMock.mockReturnValue(true);
findUniqueMock.mockResolvedValueOnce(
row({
visibility: RULE_VISIBILITY.shared_by_link,
shareSlug: "k7f2-9qxm",
}),
);
const resolved = await getReadablePublishedRule({
idOrSlug: "owned-1",
user: null,
viaShareSlug: true,
lookup: "id",
requestPath: "/api/uploads/file-1",
});
expect(resolved?.rule.id).toBe("owned-1");
expect(findUniqueMock).toHaveBeenCalledWith(
expect.objectContaining({ where: { id: "owned-1" } }),
);
});
it("lets anonymous readers use the rotating slug", async () => {
isDatabaseConfiguredMock.mockReturnValue(true);
findUniqueMock.mockResolvedValueOnce(