refactor: simplify account standing and verification levels (#3130)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-02 18:17:41 +02:00
1 parent 1abde06824
commit 1ec8f31253
488 files changed
+10390 -47117

No files matched your search

@@ -2,7 +2,6 @@
import type {ChannelID, GuildID, RoleID, UserID} from '@app/api/BrandedTypes';
import {createChannelID, createGuildID, createRoleID, guildIdToRoleId} from '@app/api/BrandedTypes';
import {Config} from '@app/api/Config';
import type {IChannelRepository} from '@app/api/channel/IChannelRepository';
import {
type ChannelFollowerRemovalCopyMode,
@@ -482,17 +481,6 @@ export class GuildOperationsService {
ValidationErrorCodes.DISCOVERABLE_GUILD_VERIFICATION_LEVEL_TOO_LOW,
);
}
if (
data.verification_level === GuildVerificationLevel.VERY_HIGH &&
data.verification_level !== currentGuild.verificationLevel &&
!Config.instance.phoneVerificationEnabled
) {
throw InputValidationError.fromCode('verification_level', ValidationErrorCodes.VALUE_MUST_BE_INTEGER_IN_RANGE, {
name: 'verification_level',
minValue: GuildVerificationLevel.NONE,
maxValue: GuildVerificationLevel.HIGH,
});
}
const isMfaLevelChange = data.mfa_level !== undefined && data.mfa_level !== currentGuild.mfaLevel;
if (isMfaLevelChange) {
const isOwner = guildData.owner_id === userId.toString();
@@ -1192,7 +1180,7 @@ export class GuildOperationsService {
verificationLevel: this.clampTemplateSetting(
template?.verification_level,
GuildVerificationLevel.NONE,
Config.instance.phoneVerificationEnabled ? GuildVerificationLevel.VERY_HIGH : GuildVerificationLevel.HIGH,
GuildVerificationLevel.HIGH,
GuildVerificationLevel.NONE,
),
explicitContentFilter: this.clampTemplateSetting(template?.explicit_content_filter, 0, 2, 0),