mirror of
https://github.com/documenso/documenso.git
synced 2026-07-10 21:15:15 +10:00
77e463e850
Extract shared tokenFingerprint() and isPublicDocumentAccessEnabled() helpers, reuse rateLimitResponse from rate-limit-middleware, deduplicate Prisma include across view/download handlers, convert error if-chain to if/else-if, move MAX_QR_RETRY_COUNT to module scope, and stop refetchInterval once document reaches terminal status.
22 lines
536 B
TypeScript
22 lines
536 B
TypeScript
type PublicAccessTeam = {
|
|
teamGlobalSettings?: {
|
|
allowPublicCompletedDocumentAccess: boolean | null;
|
|
} | null;
|
|
organisation: {
|
|
organisationGlobalSettings: {
|
|
allowPublicCompletedDocumentAccess: boolean;
|
|
};
|
|
};
|
|
} | null;
|
|
|
|
export const isPublicDocumentAccessEnabled = (team: PublicAccessTeam): boolean => {
|
|
if (!team) {
|
|
return true;
|
|
}
|
|
|
|
return (
|
|
team.teamGlobalSettings?.allowPublicCompletedDocumentAccess ??
|
|
team.organisation.organisationGlobalSettings.allowPublicCompletedDocumentAccess
|
|
);
|
|
};
|