Moderation delay WIP (#132):

* default channel value for moderation delay
This commit is contained in:
John Livingston
2024-07-09 16:15:07 +02:00
parent 00a0dca1f9
commit 7a54594967
12 changed files with 92 additions and 3 deletions

View File

@ -34,8 +34,10 @@ export class ChannelDetailsService {
const botConf = channelConfigurationOptions.bot
const slowModeDuration = channelConfigurationOptions.slowMode.duration
const moderationDelay = channelConfigurationOptions.moderation.delay
propertiesError['slowMode.duration'] = []
propertiesError['moderation.delay'] = []
if (
(typeof slowModeDuration !== 'number') ||
@ -49,6 +51,18 @@ export class ChannelDetailsService {
propertiesError['slowMode.duration'].push(ValidationErrorType.NotInRange)
}
if (
(typeof moderationDelay !== 'number') ||
isNaN(moderationDelay)
) {
propertiesError['moderation.delay'].push(ValidationErrorType.WrongType)
} else if (
moderationDelay < 0 ||
moderationDelay > 60
) {
propertiesError['moderation.delay'].push(ValidationErrorType.NotInRange)
}
// If !bot.enabled, we don't have to validate these fields:
// The backend will ignore those values.
if (botConf.enabled) {