Slow mode duration:
* channel option is no more a default value, but the current value * changing naming in accordance * changing labels and documentation
This commit is contained in:
@ -25,7 +25,7 @@ async function sanitizeChannelConfigurationOptions (
|
||||
|
||||
// slowMode not present in livechat <= 8.2.0:
|
||||
const slowModeData = data.slowMode ?? {}
|
||||
slowModeData.defaultDuration ??= 0
|
||||
slowModeData.duration ??= slowModeData.defaultDuration ?? 0 // v8.3.0 to 8.3.2: was in defaultDuration
|
||||
|
||||
if (typeof slowModeData !== 'object') {
|
||||
throw new Error('Invalid data.slowMode data type')
|
||||
@ -41,7 +41,7 @@ async function sanitizeChannelConfigurationOptions (
|
||||
// TODO: bannedJIDs
|
||||
},
|
||||
slowMode: {
|
||||
defaultDuration: _readInteger(slowModeData, 'defaultDuration', 0, 1000)
|
||||
duration: _readInteger(slowModeData, 'duration', 0, 1000)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ function getDefaultChannelConfigurationOptions (_options: RegisterServerOptions)
|
||||
commands: []
|
||||
},
|
||||
slowMode: {
|
||||
defaultDuration: 0
|
||||
duration: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ class RoomChannel {
|
||||
// This can be done without waiting for the API call to finish, but we don't want to send thousands of
|
||||
// API calls at the same time. So storing data in a map, and we well launch it sequentially at the end
|
||||
prosodyRoomUpdates.set(roomJID, {
|
||||
slow_mode_duration: channelConfigurationOptions.slowMode.defaultDuration
|
||||
slow_mode_duration: channelConfigurationOptions.slowMode.duration
|
||||
})
|
||||
|
||||
this.roomConfToUpdate.delete(roomJID)
|
||||
|
@ -36,10 +36,10 @@ interface RoomDefaults {
|
||||
affiliations?: Affiliations
|
||||
}
|
||||
|
||||
async function defaultSlowModeDuration (options: RegisterServerOptions, channelId: number): Promise<number> {
|
||||
async function slowModeDuration (options: RegisterServerOptions, channelId: number): Promise<number> {
|
||||
const channelOptions = await getChannelConfigurationOptions(options, channelId) ??
|
||||
getDefaultChannelConfigurationOptions(options)
|
||||
return channelOptions.slowMode.defaultDuration
|
||||
return channelOptions.slowMode.duration
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,7 +89,7 @@ async function initRoomApiRouter (options: RegisterServerOptions, router: Router
|
||||
name: channelInfos.displayName,
|
||||
description: '',
|
||||
// subject: channelInfos.displayName
|
||||
slow_mode_duration: await defaultSlowModeDuration(options, channelId)
|
||||
slow_mode_duration: await slowModeDuration(options, channelId)
|
||||
},
|
||||
affiliations: affiliations
|
||||
}
|
||||
@ -142,7 +142,7 @@ async function initRoomApiRouter (options: RegisterServerOptions, router: Router
|
||||
description: '',
|
||||
language: video.language,
|
||||
// subject: video.name
|
||||
slow_mode_duration: await defaultSlowModeDuration(options, video.channelId)
|
||||
slow_mode_duration: await slowModeDuration(options, video.channelId)
|
||||
},
|
||||
affiliations: affiliations
|
||||
}
|
||||
|
Reference in New Issue
Block a user