Naming:
* changing delay by duration for slow mode options * better labels
This commit is contained in:
@ -23,7 +23,10 @@ async function sanitizeChannelConfigurationOptions (
|
||||
throw new Error('Invalid data.bot data type')
|
||||
}
|
||||
|
||||
const slowModeData = data.slowMode ?? { defaultDelay: 0 } // not present in livechat <= 8.2.0
|
||||
// slowMode not present in livechat <= 8.2.0:
|
||||
const slowModeData = data.slowMode ?? {}
|
||||
slowModeData.defaultDuration ??= 0
|
||||
|
||||
if (typeof slowModeData !== 'object') {
|
||||
throw new Error('Invalid data.slowMode data type')
|
||||
}
|
||||
@ -38,7 +41,7 @@ async function sanitizeChannelConfigurationOptions (
|
||||
// TODO: bannedJIDs
|
||||
},
|
||||
slowMode: {
|
||||
defaultDelay: _readInteger(slowModeData, 'defaultDelay', 0, 1000)
|
||||
defaultDuration: _readInteger(slowModeData, 'defaultDuration', 0, 1000)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ function getDefaultChannelConfigurationOptions (_options: RegisterServerOptions)
|
||||
commands: []
|
||||
},
|
||||
slowMode: {
|
||||
defaultDelay: 0
|
||||
defaultDuration: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ class ProsodyConfigContent {
|
||||
this.muc.set('muc_room_default_history_length', 20)
|
||||
|
||||
this.muc.add('modules_enabled', 'muc_slow_mode')
|
||||
this.muc.add('slow_mode_delay_form_position', 120)
|
||||
this.muc.add('slow_mode_duration_form_position', 120)
|
||||
}
|
||||
|
||||
useAnonymous (autoBanIP: boolean): void {
|
||||
|
@ -31,15 +31,15 @@ interface RoomDefaults {
|
||||
archiving?: boolean
|
||||
|
||||
// Following fields are specific to livechat (for now), and requires a customized version for mod_muc_http_defaults.
|
||||
slow_mode_delay?: number
|
||||
slow_mode_duration?: number
|
||||
}
|
||||
affiliations?: Affiliations
|
||||
}
|
||||
|
||||
async function defaultSlowModeDelay (options: RegisterServerOptions, channelId: number): Promise<number> {
|
||||
async function defaultSlowModeDuration (options: RegisterServerOptions, channelId: number): Promise<number> {
|
||||
const channelOptions = await getChannelConfigurationOptions(options, channelId) ??
|
||||
getDefaultChannelConfigurationOptions(options)
|
||||
return channelOptions.slowMode.defaultDelay
|
||||
return channelOptions.slowMode.defaultDuration
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,7 +89,7 @@ async function initRoomApiRouter (options: RegisterServerOptions, router: Router
|
||||
name: channelInfos.displayName,
|
||||
description: '',
|
||||
// subject: channelInfos.displayName
|
||||
slow_mode_delay: await defaultSlowModeDelay(options, channelId)
|
||||
slow_mode_duration: await defaultSlowModeDuration(options, channelId)
|
||||
},
|
||||
affiliations: affiliations
|
||||
}
|
||||
@ -142,7 +142,7 @@ async function initRoomApiRouter (options: RegisterServerOptions, router: Router
|
||||
description: '',
|
||||
language: video.language,
|
||||
// subject: video.name
|
||||
slow_mode_delay: await defaultSlowModeDelay(options, video.channelId)
|
||||
slow_mode_duration: await defaultSlowModeDuration(options, video.channelId)
|
||||
},
|
||||
affiliations: affiliations
|
||||
}
|
||||
|
Reference in New Issue
Block a user