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
@@ -0,0 +1,36 @@
|
||||
import type { RuleVisibility } from "./ruleVisibility";
|
||||
|
||||
export type SharePerson = {
|
||||
email: string;
|
||||
initials: string;
|
||||
role: "owner" | "reader";
|
||||
};
|
||||
|
||||
export type RuleShareSettings = {
|
||||
visibility: RuleVisibility;
|
||||
shareSlug: string | null;
|
||||
shareUrl: string;
|
||||
shareUrlDisplay: string | null;
|
||||
title: string;
|
||||
ownerEmail: string;
|
||||
ownerInitials: string;
|
||||
readers: SharePerson[];
|
||||
copyEnabled: boolean;
|
||||
};
|
||||
|
||||
export function emailInitials(email: string): string {
|
||||
const local = email.split("@")[0] ?? "";
|
||||
const ch = local.trim().charAt(0);
|
||||
return ch.length > 0 ? ch.toUpperCase() : "?";
|
||||
}
|
||||
|
||||
/** Owner is shown separately. List the first reader, then an overflow line. */
|
||||
export function visibleShareReaders(readers: SharePerson[]): {
|
||||
shown: SharePerson[];
|
||||
overflowCount: number;
|
||||
} {
|
||||
if (readers.length <= 1) {
|
||||
return { shown: readers, overflowCount: 0 };
|
||||
}
|
||||
return { shown: readers.slice(0, 1), overflowCount: readers.length - 1 };
|
||||
}
|
||||
Reference in new issue
Block a user