mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
fix: allow rate_limit_per_user on channel creation (#1401)
This commit is contained in:
1 parent
04da3e6a6c
commit
6ebb43d10d
4 files changed
+58
-24
No files matched your search
@@ -155,7 +155,7 @@ export class ChannelOperationsService {
|
||||
nsfw: requestedNsfwOverride,
|
||||
content_warning_level: requestedContentWarningLevel,
|
||||
content_warning_text: requestedContentWarningText,
|
||||
rate_limit_per_user: 0,
|
||||
rate_limit_per_user: params.data.rate_limit_per_user ?? 0,
|
||||
bitrate: params.data.type === ChannelTypes.GUILD_VOICE ? (params.data.bitrate ?? 64000) : null,
|
||||
user_limit: params.data.type === ChannelTypes.GUILD_VOICE ? (params.data.user_limit ?? 0) : null,
|
||||
voice_connection_limit:
|
||||
|
||||
@@ -98,6 +98,24 @@ describe('Guild Channel Management', () => {
|
||||
});
|
||||
});
|
||||
describe('Channel Slowmode (rate_limit_per_user)', () => {
|
||||
test('should set slowmode when creating a channel', async () => {
|
||||
const account = await createTestAccount(harness);
|
||||
const guild = await createGuild(harness, account.token, 'We go slow');
|
||||
const channel = await createBuilder<ChannelResponse>(harness, account.token)
|
||||
.post(`/guilds/${guild.id}/channels`)
|
||||
.body({name: 'slooooow', type: ChannelTypes.GUILD_TEXT, rate_limit_per_user: 60})
|
||||
.execute();
|
||||
expect(channel.rate_limit_per_user).toBe(60);
|
||||
});
|
||||
test('should reject invalid slowmode when creating a channel', async () => {
|
||||
const account = await createTestAccount(harness);
|
||||
const guild = await createGuild(harness, account.token, 'Test Guild');
|
||||
await createBuilder(harness, account.token)
|
||||
.post(`/guilds/${guild.id}/channels`)
|
||||
.body({name: 'too-fast-omg', type: ChannelTypes.GUILD_TEXT, rate_limit_per_user: Number.MAX_SAFE_INTEGER})
|
||||
.expect(HTTP_STATUS.BAD_REQUEST)
|
||||
.execute();
|
||||
});
|
||||
test('should set slowmode on text channel', async () => {
|
||||
const account = await createTestAccount(harness);
|
||||
const guild = await createGuild(harness, account.token, 'Test Guild');
|
||||
|
||||
@@ -27597,6 +27597,10 @@
|
||||
},
|
||||
"description": "Permission overwrites for roles and members"
|
||||
},
|
||||
"rate_limit_per_user": {
|
||||
"anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600, "format": "int32"}, {"type": "null"}],
|
||||
"description": "Slowmode delay in seconds (0-21600)"
|
||||
},
|
||||
"nsfw": {
|
||||
"anyOf": [{"type": "boolean"}, {"type": "null"}],
|
||||
"description": "Legacy: setting true maps to nsfw_override=true; setting false maps to nsfw_override=null (inherit). Prefer nsfw_override."
|
||||
@@ -27610,10 +27614,6 @@
|
||||
"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}],
|
||||
"description": "Custom channel content warning text (max 200 characters); null inherits from parent or guild"
|
||||
},
|
||||
"rate_limit_per_user": {
|
||||
"anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600, "format": "int32"}, {"type": "null"}],
|
||||
"description": "Slowmode delay in seconds (0-21600)"
|
||||
},
|
||||
"icon": {
|
||||
"anyOf": [{"$ref": "#/components/schemas/Base64ImageType"}, {"type": "null"}],
|
||||
"description": "Base64-encoded icon image for group DM channels"
|
||||
@@ -27691,6 +27691,10 @@
|
||||
},
|
||||
"description": "Permission overwrites for roles and members"
|
||||
},
|
||||
"rate_limit_per_user": {
|
||||
"anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600, "format": "int32"}, {"type": "null"}],
|
||||
"description": "Slowmode delay in seconds (0-21600)"
|
||||
},
|
||||
"nsfw": {
|
||||
"anyOf": [{"type": "boolean"}, {"type": "null"}],
|
||||
"description": "Legacy: setting true maps to nsfw_override=true; setting false maps to nsfw_override=null (inherit). Prefer nsfw_override."
|
||||
@@ -27704,10 +27708,6 @@
|
||||
"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}],
|
||||
"description": "Custom channel content warning text (max 200 characters); null inherits from parent or guild"
|
||||
},
|
||||
"rate_limit_per_user": {
|
||||
"anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600, "format": "int32"}, {"type": "null"}],
|
||||
"description": "Slowmode delay in seconds (0-21600)"
|
||||
},
|
||||
"icon": {
|
||||
"anyOf": [{"$ref": "#/components/schemas/Base64ImageType"}, {"type": "null"}],
|
||||
"description": "Base64-encoded icon image for group DM channels"
|
||||
@@ -27775,6 +27775,10 @@
|
||||
},
|
||||
"description": "Permission overwrites for roles and members"
|
||||
},
|
||||
"rate_limit_per_user": {
|
||||
"anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600, "format": "int32"}, {"type": "null"}],
|
||||
"description": "Slowmode delay in seconds (0-21600)"
|
||||
},
|
||||
"nsfw": {
|
||||
"anyOf": [{"type": "boolean"}, {"type": "null"}],
|
||||
"description": "Legacy: setting true maps to nsfw_override=true; setting false maps to nsfw_override=null (inherit). Prefer nsfw_override."
|
||||
@@ -27788,10 +27792,6 @@
|
||||
"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}],
|
||||
"description": "Custom channel content warning text (max 200 characters); null inherits from parent or guild"
|
||||
},
|
||||
"rate_limit_per_user": {
|
||||
"anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600, "format": "int32"}, {"type": "null"}],
|
||||
"description": "Slowmode delay in seconds (0-21600)"
|
||||
},
|
||||
"icon": {
|
||||
"anyOf": [{"$ref": "#/components/schemas/Base64ImageType"}, {"type": "null"}],
|
||||
"description": "Base64-encoded icon image for group DM channels"
|
||||
@@ -27859,6 +27859,10 @@
|
||||
},
|
||||
"description": "Permission overwrites for roles and members"
|
||||
},
|
||||
"rate_limit_per_user": {
|
||||
"anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600, "format": "int32"}, {"type": "null"}],
|
||||
"description": "Slowmode delay in seconds (0-21600)"
|
||||
},
|
||||
"nsfw": {
|
||||
"anyOf": [{"type": "boolean"}, {"type": "null"}],
|
||||
"description": "Legacy: setting true maps to nsfw_override=true; setting false maps to nsfw_override=null (inherit). Prefer nsfw_override."
|
||||
@@ -27872,10 +27876,6 @@
|
||||
"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}],
|
||||
"description": "Custom channel content warning text (max 200 characters); null inherits from parent or guild"
|
||||
},
|
||||
"rate_limit_per_user": {
|
||||
"anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600, "format": "int32"}, {"type": "null"}],
|
||||
"description": "Slowmode delay in seconds (0-21600)"
|
||||
},
|
||||
"icon": {
|
||||
"anyOf": [{"$ref": "#/components/schemas/Base64ImageType"}, {"type": "null"}],
|
||||
"description": "Base64-encoded icon image for group DM channels"
|
||||
@@ -30814,6 +30814,10 @@
|
||||
},
|
||||
"description": "Permission overwrites for roles and members"
|
||||
},
|
||||
"rate_limit_per_user": {
|
||||
"anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600, "format": "int32"}, {"type": "null"}],
|
||||
"description": "Slowmode delay in seconds (0-21600)"
|
||||
},
|
||||
"nsfw": {"type": "boolean", "description": "Whether the channel is marked as NSFW"},
|
||||
"nsfw_override": {
|
||||
"anyOf": [{"type": "boolean"}, {"type": "null"}],
|
||||
@@ -30878,6 +30882,10 @@
|
||||
},
|
||||
"description": "Permission overwrites for roles and members"
|
||||
},
|
||||
"rate_limit_per_user": {
|
||||
"anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600, "format": "int32"}, {"type": "null"}],
|
||||
"description": "Slowmode delay in seconds (0-21600)"
|
||||
},
|
||||
"nsfw": {"type": "boolean", "description": "Whether the channel is marked as NSFW"},
|
||||
"nsfw_override": {
|
||||
"anyOf": [{"type": "boolean"}, {"type": "null"}],
|
||||
@@ -30942,6 +30950,10 @@
|
||||
},
|
||||
"description": "Permission overwrites for roles and members"
|
||||
},
|
||||
"rate_limit_per_user": {
|
||||
"anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600, "format": "int32"}, {"type": "null"}],
|
||||
"description": "Slowmode delay in seconds (0-21600)"
|
||||
},
|
||||
"nsfw": {"type": "boolean", "description": "Whether the channel is marked as NSFW"},
|
||||
"nsfw_override": {
|
||||
"anyOf": [{"type": "boolean"}, {"type": "null"}],
|
||||
@@ -31006,6 +31018,10 @@
|
||||
},
|
||||
"description": "Permission overwrites for roles and members"
|
||||
},
|
||||
"rate_limit_per_user": {
|
||||
"anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600, "format": "int32"}, {"type": "null"}],
|
||||
"description": "Slowmode delay in seconds (0-21600)"
|
||||
},
|
||||
"nsfw": {"type": "boolean", "description": "Whether the channel is marked as NSFW"},
|
||||
"nsfw_override": {
|
||||
"anyOf": [{"type": "boolean"}, {"type": "null"}],
|
||||
|
||||
Reference in new issue
Block a user