Start every Rule private, with a rotating link and files that follow its readers.
New Rules stay off lists until the person who holds the pen turns on a share link, or the team features one. Uploaded files are readable only by those readers, stripped of location metadata, and deleted with the Rule, draft, or account.
This commit is contained in:
1 parent
642551064c
commit
5cbda35e32
50 files changed
+2429
-219
No files matched your search
@@ -1,24 +1,15 @@
|
||||
import type { Prisma } from "@prisma/client";
|
||||
import { RULE_VISIBILITY } from "./ruleVisibility";
|
||||
|
||||
/**
|
||||
* Access model for published CommunityRules:
|
||||
*
|
||||
* - **Readable without sign-in:** every published row is share-by-link at
|
||||
* `/rules/[id]` and `GET /api/rules/[id]`.
|
||||
* - **Listed** (public catalog `GET /api/rules`, sitemap, indexable): owned
|
||||
* rows, and ownerless rows that are *not* waiting on a guest claim
|
||||
* (including rules orphaned when an account is deleted).
|
||||
* - **Unlisted** (omitted from the catalog and sitemap, `noindex`): guest
|
||||
* publishes with `userId` null and `claimTokenHash` set, until claimed.
|
||||
*/
|
||||
export function isListedPublishedRule(row: {
|
||||
userId: string | null;
|
||||
claimTokenHash: string | null;
|
||||
}): boolean {
|
||||
return row.userId != null || row.claimTokenHash == null;
|
||||
}
|
||||
export {
|
||||
RULE_VISIBILITY,
|
||||
isListedPublishedRule,
|
||||
canReadPublishedRule,
|
||||
isPrivilegedAdminRead,
|
||||
} from "./ruleVisibility";
|
||||
export type { RuleVisibility, PublishedRuleReadAccess } from "./ruleVisibility";
|
||||
|
||||
/** Prisma `where` for the public catalog and sitemap. */
|
||||
export const LISTED_PUBLISHED_RULE_WHERE: Prisma.PublishedRuleWhereInput = {
|
||||
OR: [{ userId: { not: null } }, { claimTokenHash: null }],
|
||||
visibility: RULE_VISIBILITY.public_and_featured,
|
||||
};
|
||||
Reference in new issue
Block a user