mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
refactor: simplify account standing and verification levels (#3130)
This commit is contained in:
1 parent
1abde06824
commit
1ec8f31253
488 files changed
+10390
-47117
No files matched your search
@@ -58,19 +58,18 @@ export const UserFlags = {
|
||||
FRIENDLY_BOT_MANUAL_APPROVAL: 1n << 5n,
|
||||
SPAMMER: 1n << 6n,
|
||||
DELETED: 1n << 34n,
|
||||
DISABLED_SUSPICIOUS_ACTIVITY: 1n << 35n,
|
||||
SELF_DELETED: 1n << 36n,
|
||||
DISABLED: 1n << 38n,
|
||||
HAS_SESSION_STARTED: 1n << 39n,
|
||||
RATE_LIMIT_BYPASS: 1n << 47n,
|
||||
REPORT_BANNED: 1n << 48n,
|
||||
VERIFIED_NOT_UNDERAGE: 1n << 49n,
|
||||
ACCOUNT_LIMITED: 1n << 50n,
|
||||
HAS_DISMISSED_PREMIUM_ONBOARDING: 1n << 51n,
|
||||
APP_STORE_REVIEWER: 1n << 53n,
|
||||
STAFF_HIDDEN: 1n << 57n,
|
||||
AGE_VERIFIED_ADULT: 1n << 60n,
|
||||
FORCE_INBOUND_PHONE_VERIFICATION: 1n << 61n,
|
||||
NOT_SUSPICIOUS: 1n << 62n,
|
||||
LIMIT_EXEMPT: 1n << 62n,
|
||||
} as const;
|
||||
export const UserFlagsDescriptions: Record<keyof typeof UserFlags, string> = {
|
||||
STAFF: 'User is a staff member',
|
||||
@@ -81,19 +80,18 @@ export const UserFlagsDescriptions: Record<keyof typeof UserFlags, string> = {
|
||||
FRIENDLY_BOT_MANUAL_APPROVAL: 'Bot requires manual approval for friend requests',
|
||||
SPAMMER: 'User is flagged as a spammer',
|
||||
DELETED: 'User account has been deleted',
|
||||
DISABLED_SUSPICIOUS_ACTIVITY: 'User account disabled due to suspicious activity',
|
||||
SELF_DELETED: 'User account was self-deleted',
|
||||
DISABLED: 'User account is disabled',
|
||||
HAS_SESSION_STARTED: 'User has started a session',
|
||||
RATE_LIMIT_BYPASS: 'User can bypass rate limits',
|
||||
REPORT_BANNED: 'User is banned from reporting',
|
||||
VERIFIED_NOT_UNDERAGE: 'User is verified as not underage',
|
||||
ACCOUNT_LIMITED: 'User account is limited',
|
||||
HAS_DISMISSED_PREMIUM_ONBOARDING: 'User has dismissed premium onboarding',
|
||||
APP_STORE_REVIEWER: 'User is an app store reviewer',
|
||||
STAFF_HIDDEN: 'User staff status is hidden from public flags',
|
||||
AGE_VERIFIED_ADULT: 'User has verified their age as an adult via credit card verification',
|
||||
FORCE_INBOUND_PHONE_VERIFICATION: 'User is forced through inbound phone verification, for debugging',
|
||||
NOT_SUSPICIOUS: 'User is permanently exempt from automatic suspicious-activity flagging',
|
||||
LIMIT_EXEMPT: 'User is permanently exempt from account limitation',
|
||||
};
|
||||
export const PremiumFlags = {
|
||||
DISCRIMINATOR: 1 << 0,
|
||||
@@ -131,7 +129,8 @@ export const LEGACY_PREMIUM_FLAGS_MASK: bigint = LEGACY_PREMIUM_FLAG_BITS_TO_NEW
|
||||
(mask, [legacy]) => mask | legacy,
|
||||
0n,
|
||||
);
|
||||
export const LEGACY_DEAD_USER_FLAGS_MASK: bigint = (1n << 52n) | (1n << 54n) | (1n << 55n) | (1n << 56n) | (1n << 58n);
|
||||
export const LEGACY_DEAD_USER_FLAGS_MASK: bigint =
|
||||
(1n << 35n) | (1n << 52n) | (1n << 54n) | (1n << 55n) | (1n << 56n) | (1n << 58n) | (1n << 61n);
|
||||
|
||||
export function extractPremiumFlagsFromLegacyUserFlags(legacyFlags: bigint): number {
|
||||
let result = 0;
|
||||
@@ -170,49 +169,6 @@ export const PublicUserFlagsDescriptions: Record<keyof typeof PublicUserFlags, s
|
||||
FRIENDLY_BOT_MANUAL_APPROVAL: 'Bot requires manual approval for friend requests',
|
||||
SPAMMER: 'User is flagged as a spammer',
|
||||
};
|
||||
export const SuspiciousActivityFlags = {
|
||||
REQUIRE_VERIFIED_EMAIL: 1 << 0,
|
||||
REQUIRE_REVERIFIED_EMAIL: 1 << 1,
|
||||
REQUIRE_VERIFIED_PHONE: 1 << 2,
|
||||
REQUIRE_REVERIFIED_PHONE: 1 << 3,
|
||||
REQUIRE_VERIFIED_EMAIL_OR_VERIFIED_PHONE: 1 << 4,
|
||||
REQUIRE_REVERIFIED_EMAIL_OR_VERIFIED_PHONE: 1 << 5,
|
||||
REQUIRE_VERIFIED_EMAIL_OR_REVERIFIED_PHONE: 1 << 6,
|
||||
REQUIRE_REVERIFIED_EMAIL_OR_REVERIFIED_PHONE: 1 << 7,
|
||||
REQUIRE_INBOUND_PHONE_VERIFICATION: 1 << 8,
|
||||
} as const;
|
||||
export const SuspiciousActivityFlagsDescriptions: Record<keyof typeof SuspiciousActivityFlags, string> = {
|
||||
REQUIRE_VERIFIED_EMAIL: 'Requires verified email address',
|
||||
REQUIRE_REVERIFIED_EMAIL: 'Requires re-verified email address',
|
||||
REQUIRE_VERIFIED_PHONE: 'Requires verified phone number',
|
||||
REQUIRE_REVERIFIED_PHONE: 'Requires re-verified phone number',
|
||||
REQUIRE_VERIFIED_EMAIL_OR_VERIFIED_PHONE: 'Requires verified email or verified phone',
|
||||
REQUIRE_REVERIFIED_EMAIL_OR_VERIFIED_PHONE: 'Requires re-verified email or re-verified phone',
|
||||
REQUIRE_VERIFIED_EMAIL_OR_REVERIFIED_PHONE: 'Requires verified email or re-verified phone',
|
||||
REQUIRE_REVERIFIED_EMAIL_OR_REVERIFIED_PHONE: 'Requires re-verified email or re-verified phone',
|
||||
REQUIRE_INBOUND_PHONE_VERIFICATION: 'Requires inbound SMS verification (user must text code to platform number)',
|
||||
};
|
||||
export const ALL_SUSPICIOUS_ACTIVITY_FLAGS = Object.values(SuspiciousActivityFlags).reduce(
|
||||
(mask, flag) => mask | flag,
|
||||
0,
|
||||
);
|
||||
export const DEFERRED_PHONE_ON_COMMUNITY_JOIN = 1 << 16;
|
||||
export const PHONE_GATE_PROMOTED_FROM_DEFERRAL = 1 << 17;
|
||||
export const DEFERRABLE_PHONE_FLAGS =
|
||||
SuspiciousActivityFlags.REQUIRE_VERIFIED_PHONE | SuspiciousActivityFlags.REQUIRE_REVERIFIED_PHONE;
|
||||
export const NEVER_DEFERRABLE_PHONE_FLAGS = SuspiciousActivityFlags.REQUIRE_INBOUND_PHONE_VERIFICATION;
|
||||
export function imposePhoneRequirements(currentFlags: number, addedFlags: number): number {
|
||||
const nextFlags = currentFlags | addedFlags;
|
||||
if ((addedFlags & DEFERRABLE_PHONE_FLAGS) === 0) {
|
||||
return nextFlags;
|
||||
}
|
||||
return nextFlags & ~DEFERRED_PHONE_ON_COMMUNITY_JOIN & ~PHONE_GATE_PROMOTED_FROM_DEFERRAL;
|
||||
}
|
||||
export const ADMIN_PHONE_TOGGLE_CLEARABLE_FLAGS =
|
||||
DEFERRED_PHONE_ON_COMMUNITY_JOIN |
|
||||
PHONE_GATE_PROMOTED_FROM_DEFERRAL |
|
||||
SuspiciousActivityFlags.REQUIRE_VERIFIED_PHONE |
|
||||
SuspiciousActivityFlags.REQUIRE_INBOUND_PHONE_VERIFICATION;
|
||||
export const ThemeTypes = {
|
||||
DARK: 'dark',
|
||||
DARK_LEGACY: 'dark_legacy',
|
||||
|
||||
Reference in new issue
Block a user