mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
refactor: remove the CTP_MEMBER user flag (#2465)
This commit is contained in:
1 parent
639ade3802
commit
ab68b61653
45 files changed
+206
-429
No files matched your search
@@ -443,8 +443,7 @@ export class MessageMentionService {
|
||||
return validUserIds;
|
||||
}
|
||||
const authorHasStaffFlag = (author.flags & UserFlags.STAFF) === UserFlags.STAFF;
|
||||
const authorHasCtpFlag = (author.flags & UserFlags.CTP_MEMBER) === UserFlags.CTP_MEMBER;
|
||||
if (authorHasStaffFlag || authorHasCtpFlag) {
|
||||
if (authorHasStaffFlag) {
|
||||
return validUserIds;
|
||||
}
|
||||
const staffTargets = validUsers.filter((user) => (user.flags & UserFlags.STAFF) === UserFlags.STAFF);
|
||||
|
||||
@@ -24076,7 +24076,6 @@
|
||||
"maximum": 2147483647,
|
||||
"x-bitflagValues": [
|
||||
{"name": "STAFF", "value": "1", "description": "User is a staff member"},
|
||||
{"name": "CTP_MEMBER", "value": "2", "description": "User is a CTP member"},
|
||||
{"name": "PARTNER", "value": "4", "description": "User is a partner"},
|
||||
{"name": "BUG_HUNTER", "value": "8", "description": "User is a bug hunter"},
|
||||
{"name": "FRIENDLY_BOT", "value": "16", "description": "Bot accepts friend requests from users"},
|
||||
|
||||
@@ -275,7 +275,7 @@ export function createPremiumClearPatch(): Partial<UserRow> {
|
||||
return mapExpiredPremiumFields(() => null) as Partial<UserRow>;
|
||||
}
|
||||
|
||||
const PROFILE_SUBSTRING_EXEMPT_FLAGS = UserFlags.STAFF | UserFlags.CTP_MEMBER;
|
||||
const PROFILE_SUBSTRING_EXEMPT_FLAGS = UserFlags.STAFF;
|
||||
|
||||
export function isProfileSubstringExempt(user: Pick<PremiumCheckable, 'flags'>): boolean {
|
||||
return (user.flags & PROFILE_SUBSTRING_EXEMPT_FLAGS) !== 0n;
|
||||
|
||||
@@ -85,12 +85,6 @@ describe('User flags in responses', () => {
|
||||
const {json} = await fetchUserMe(harness, account.token);
|
||||
expect(json.flags & PublicUserFlags.SPAMMER).toBe(PublicUserFlags.SPAMMER);
|
||||
});
|
||||
test('GET /users/@me includes CTP_MEMBER when set', async () => {
|
||||
const account = await createTestAccount(harness);
|
||||
await setUserFlags(harness, account.userId, UserFlags.CTP_MEMBER);
|
||||
const {json} = await fetchUserMe(harness, account.token);
|
||||
expect(json.flags & PublicUserFlags.CTP_MEMBER).toBe(PublicUserFlags.CTP_MEMBER);
|
||||
});
|
||||
test('PATCH /users/@me does not leak internal flags', async () => {
|
||||
const account = await createTestAccount(harness);
|
||||
await setUserFlags(harness, account.userId, UserFlags.STAFF | UserFlags.SPAMMER | UserFlags.HIGH_GLOBAL_RATE_LIMIT);
|
||||
|
||||
Reference in new issue
Block a user