Show invited people the Rule, let them copy its cards for their community, and replace an expired invitation link.
This commit is contained in:
1 parent
727a92a9ac
commit
3c984e00c5
37 files changed
+1962
-19
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { parsePublishedDocumentForCommunityRuleDisplay } from "./publishedDocumentToDisplaySections";
|
||||
import { formatInviteCountWord } from "./parseInviteEmails";
|
||||
import { RULE_SECTION_CATEGORY } from "./ruleSectionsFromMethodSelections";
|
||||
import sharedTerms from "../../messages/en/create/sharedTerms.json";
|
||||
|
||||
@@ -37,8 +38,11 @@ export function clipCommunityInviteDescription(
|
||||
return trimmed.slice(0, DESCRIPTION_MAX).trimEnd();
|
||||
}
|
||||
|
||||
/** Tag on the invite Rule card (`3 VALUES AND 6 CARDS`). Shared terms do not count. */
|
||||
export function inviteRuleCountsLabel(document: unknown): string {
|
||||
/** Values vs method cards on a published Rule. Shared terms do not count. */
|
||||
export function inviteRuleValueAndCardCounts(document: unknown): {
|
||||
values: number;
|
||||
cards: number;
|
||||
} {
|
||||
const sections = parsePublishedDocumentForCommunityRuleDisplay(document);
|
||||
let values = 0;
|
||||
let cards = 0;
|
||||
@@ -50,7 +54,21 @@ export function inviteRuleCountsLabel(document: unknown): string {
|
||||
cards += n;
|
||||
}
|
||||
}
|
||||
return { values, cards };
|
||||
}
|
||||
|
||||
/** Tag on the invite Rule card (`3 VALUES AND 6 CARDS`). Shared terms do not count. */
|
||||
export function inviteRuleCountsLabel(document: unknown): string {
|
||||
const { values, cards } = inviteRuleValueAndCardCounts(document);
|
||||
const valuePart = values === 1 ? "1 VALUE" : `${values} VALUES`;
|
||||
const cardPart = cards === 1 ? "1 CARD" : `${cards} CARDS`;
|
||||
return `${valuePart} AND ${cardPart}`;
|
||||
}
|
||||
|
||||
/** Spoken counts for Make a copy (`three values and six cards`). */
|
||||
export function inviteRuleCountsSpoken(document: unknown): string {
|
||||
const { values, cards } = inviteRuleValueAndCardCounts(document);
|
||||
const valueNoun = values === 1 ? "value" : "values";
|
||||
const cardNoun = cards === 1 ? "card" : "cards";
|
||||
return `${formatInviteCountWord(values)} ${valueNoun} and ${formatInviteCountWord(cards)} ${cardNoun}`;
|
||||
}
|
||||
Reference in new issue
Block a user