Refine onboarding state and nickname checks
This commit is contained in:
1 parent
5579db54da
commit
9c013f7d4f
33 files changed
+1523
-119
No files matched your search
@@ -96,6 +96,22 @@ function hasRepeatedPhrase(text: string): boolean {
|
||||
return [...phrases.values()].some((count) => count >= 3);
|
||||
}
|
||||
|
||||
function canAdvanceDiscordStep(derived: DerivedState): boolean {
|
||||
if (
|
||||
derived.phase.kind === "completed" ||
|
||||
derived.phase.kind === "step1-completed"
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (derived.phase.kind !== "deadline-near") {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !derived.phase.remaining.includes("nickname") &&
|
||||
!derived.phase.remaining.includes("photo");
|
||||
}
|
||||
|
||||
function markValidation(result: ValidationResult): ValidationResult {
|
||||
const activeSpan = trace.getActiveSpan();
|
||||
activeSpan?.setAttributes({
|
||||
@@ -137,7 +153,7 @@ export function validateOnboardingResponse(
|
||||
|
||||
if (
|
||||
mentionsDiscord &&
|
||||
derived.phase.kind !== "completed" &&
|
||||
!canAdvanceDiscordStep(derived) &&
|
||||
advancesDiscordStep &&
|
||||
!defersDiscordStep
|
||||
) {
|
||||
|
||||
Reference in new issue
Block a user