fix(guild): treat very high as high without phone verification (#3095)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-01 20:33:02 +02:00
1 parent d691047884
commit 2df82b2b5e
28 files changed
+289 -18

No files matched your search

@@ -100,6 +100,7 @@ const DEFAULT_INSTANCE_FEATURES: InstanceFeatures = {
self_hosted: false,
presigned_attachment_uploads: false,
emails_enabled: false,
phone_verification_enabled: true,
};
export const DEFAULT_INSTANCE_REGISTRATION: InstanceRegistration = {
@@ -516,6 +517,10 @@ class RuntimeConfig {
return this.features.emails_enabled;
}
get phoneVerificationEnabled(): boolean {
return this.features.phone_verification_enabled;
}
get productName(): string {
return this.appPublic.branding.product_name.trim() || DEFAULT_APP_PUBLIC_CONFIG.branding.product_name;
}
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {useFormSubmit} from '@app/features/app/hooks/useFormSubmit';
import RuntimeConfig from '@app/features/app/state/RuntimeConfig';
import * as GuildCommands from '@app/features/guild/commands/GuildCommands';
import styles from '@app/features/guild/components/modals/guild_tabs/GuildModerationTab.module.css';
import Guilds from '@app/features/guild/state/Guilds';
@@ -176,6 +177,7 @@ const GuildModerationTab: React.FC<{guildId: string}> = observer(({guildId}) =>
const canManageGuild = Permission.can(Permissions.MANAGE_GUILD, {guildId});
const isGuildOwner = guild?.ownerId === currentUser?.id;
const isDiscoverable = guild?.features.has(GuildFeatures.DISCOVERABLE) ?? false;
const phoneVerificationEnabled = RuntimeConfig.phoneVerificationEnabled;
const remoteValues: FormInputs = {
verification_level: guild?.verificationLevel ?? GuildVerificationLevel.NONE,
mfa_level: guild?.mfaLevel ?? GuildMFALevel.NONE,
@@ -258,7 +260,7 @@ const GuildModerationTab: React.FC<{guildId: string}> = observer(({guildId}) =>
}
return;
};
const verificationLevelOptions: ReadonlyArray<RadioOption<number>> = [
const allVerificationLevelOptions: ReadonlyArray<RadioOption<number>> = [
{
value: GuildVerificationLevel.NONE,
name: i18n._(VERIFICATION_LEVEL_NONE_NAME_DESCRIPTOR),
@@ -286,6 +288,9 @@ const GuildModerationTab: React.FC<{guildId: string}> = observer(({guildId}) =>
desc: i18n._(VERIFICATION_LEVEL_VERY_HIGH_DESCRIPTION_DESCRIPTOR),
},
];
const verificationLevelOptions = phoneVerificationEnabled
? allVerificationLevelOptions
: allVerificationLevelOptions.filter((option) => option.value !== GuildVerificationLevel.VERY_HIGH);
const matureContentOptions: ReadonlyArray<ComboboxOption<string>> = [
{value: 'on', label: i18n._(MATURE_CONTENT_ON_DESCRIPTOR)},
{value: 'off', label: i18n._(MATURE_CONTENT_OFF_DESCRIPTOR)},
@@ -324,7 +329,11 @@ const GuildModerationTab: React.FC<{guildId: string}> = observer(({guildId}) =>
control={form.control}
render={({field}) => (
<RadioGroup
value={getEffectiveGuildVerificationLevel(field.value ?? GuildVerificationLevel.NONE, isDiscoverable)}
value={getEffectiveGuildVerificationLevel(
field.value ?? GuildVerificationLevel.NONE,
isDiscoverable,
phoneVerificationEnabled,
)}
onChange={field.onChange}
disabled={!canManageGuild}
options={verificationLevelOptions}
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import RuntimeConfig from '@app/features/app/state/RuntimeConfig';
import type {Guild} from '@app/features/guild/models/Guild';
import Guilds from '@app/features/guild/state/Guilds';
import GuildMembers from '@app/features/member/state/GuildMembers';
@@ -143,6 +144,7 @@ class GuildVerification {
const verificationLevel = getEffectiveGuildVerificationLevel(
guild.verificationLevel ?? GuildVerificationLevel.NONE,
guild.features.has(GuildFeatures.DISCOVERABLE),
RuntimeConfig.phoneVerificationEnabled,
);
if (verificationLevel === GuildVerificationLevel.NONE) {
return {canAccess: true};
@@ -320,6 +320,7 @@ const BOOTSTRAP_ENDPOINT = 'https://primary.test/api';
self_hosted: false,
presigned_attachment_uploads: false,
emails_enabled: false,
phone_verification_enabled: true,
},
gif: {provider: 'klipy', display_name: 'Klipy', attribution_required: false},
sso: {enabled: false, enforced: false, display_name: null, redirect_uri: ''},