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:
4
client/@types/global.d.ts
vendored
4
client/@types/global.d.ts
vendored
@ -44,8 +44,8 @@ declare const LOC_LIVECHAT_CONFIGURATION_DESC: string
|
||||
declare const LOC_LIVECHAT_CONFIGURATION_PLEASE_SELECT: string
|
||||
declare const LOC_LIVECHAT_CONFIGURATION_CHANNEL_TITLE: string
|
||||
declare const LOC_LIVECHAT_CONFIGURATION_CHANNEL_DESC: string
|
||||
declare const LOC_LIVECHAT_CONFIGURATION_CHANNEL_DEFAULT_SLOW_MODE_LABEL: string
|
||||
declare const LOC_LIVECHAT_CONFIGURATION_CHANNEL_DEFAULT_SLOW_MODE_DESC: string
|
||||
declare const LOC_LIVECHAT_CONFIGURATION_CHANNEL_SLOW_MODE_LABEL: string
|
||||
declare const LOC_LIVECHAT_CONFIGURATION_CHANNEL_SLOW_MODE_DESC: string
|
||||
declare const LOC_LIVECHAT_CONFIGURATION_CHANNEL_ENABLE_BOT_LABEL: string
|
||||
declare const LOC_LIVECHAT_CONFIGURATION_CHANNEL_BOT_OPTIONS_TITLE: string
|
||||
declare const LOC_LIVECHAT_CONFIGURATION_CHANNEL_FORBIDDEN_WORDS_LABEL: string
|
||||
|
@ -11,8 +11,8 @@
|
||||
<form livechat-configuration-channel-options role="form">
|
||||
<div class="row mt-3">
|
||||
<div class="col-12 col-lg-4 col-xl-3">
|
||||
<h2>{{defaultSlowModeLabel}}</h2>
|
||||
<p>{{{defaultSlowModeDesc}}}</p>
|
||||
<h2>{{slowModeLabel}}</h2>
|
||||
<p>{{{slowModeDesc}}}</p>
|
||||
{{{helpButtonSlowMode}}}
|
||||
</div>
|
||||
<div class="col-12 col-lg-8 col-xl-9">
|
||||
@ -20,12 +20,12 @@
|
||||
<label>
|
||||
<input
|
||||
type="number"
|
||||
name="slow_mode_default_duration"
|
||||
name="slow_mode_duration"
|
||||
class="form-control"
|
||||
min="0"
|
||||
max="1000"
|
||||
id="peertube-livechat-slow-mode-default-duration"
|
||||
value="{{channelConfiguration.configuration.slowMode.defaultDuration}}"
|
||||
id="peertube-livechat-slow-mode-duration"
|
||||
value="{{channelConfiguration.configuration.slowMode.duration}}"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
@ -69,10 +69,8 @@ async function fillLabels (
|
||||
view.title = await peertubeHelpers.translate(LOC_LIVECHAT_CONFIGURATION_CHANNEL_TITLE)
|
||||
view.description = await peertubeHelpers.translate(LOC_LIVECHAT_CONFIGURATION_CHANNEL_DESC)
|
||||
|
||||
view.defaultSlowModeLabel = await peertubeHelpers.translate(
|
||||
LOC_LIVECHAT_CONFIGURATION_CHANNEL_DEFAULT_SLOW_MODE_LABEL
|
||||
)
|
||||
view.defaultSlowModeDesc = await peertubeHelpers.translate(LOC_LIVECHAT_CONFIGURATION_CHANNEL_DEFAULT_SLOW_MODE_DESC)
|
||||
view.slowModeLabel = await peertubeHelpers.translate(LOC_LIVECHAT_CONFIGURATION_CHANNEL_SLOW_MODE_LABEL)
|
||||
view.slowModeDesc = await peertubeHelpers.translate(LOC_LIVECHAT_CONFIGURATION_CHANNEL_SLOW_MODE_DESC)
|
||||
view.enableBot = await peertubeHelpers.translate(LOC_LIVECHAT_CONFIGURATION_CHANNEL_ENABLE_BOT_LABEL)
|
||||
view.botOptions = await peertubeHelpers.translate(LOC_LIVECHAT_CONFIGURATION_CHANNEL_BOT_OPTIONS_TITLE)
|
||||
view.forbiddenWords = await peertubeHelpers.translate(LOC_LIVECHAT_CONFIGURATION_CHANNEL_FORBIDDEN_WORDS_LABEL)
|
||||
|
@ -165,16 +165,16 @@ async function vivifyConfigurationChannel (
|
||||
|
||||
const validateData: Function = async (channelConfigurationOptions: ChannelConfigurationOptions): Promise<boolean> => {
|
||||
const botConf = channelConfigurationOptions.bot
|
||||
const slowModeDefaultDuration = channelConfigurationOptions.slowMode.defaultDuration
|
||||
const slowModeDuration = channelConfigurationOptions.slowMode.duration
|
||||
const errorFieldSelectors = []
|
||||
|
||||
if (
|
||||
(typeof slowModeDefaultDuration !== 'number') ||
|
||||
isNaN(slowModeDefaultDuration) ||
|
||||
slowModeDefaultDuration < 0 ||
|
||||
slowModeDefaultDuration > 1000
|
||||
(typeof slowModeDuration !== 'number') ||
|
||||
isNaN(slowModeDuration) ||
|
||||
slowModeDuration < 0 ||
|
||||
slowModeDuration > 1000
|
||||
) {
|
||||
const selector = '#peertube-livechat-slow-mode-default-duration'
|
||||
const selector = '#peertube-livechat-slow-mode-duration'
|
||||
errorFieldSelectors.push(selector)
|
||||
await displayError(selector, await translate(LOC_INVALID_VALUE))
|
||||
}
|
||||
@ -233,7 +233,7 @@ async function vivifyConfigurationChannel (
|
||||
removeDisplayedErrors()
|
||||
const channelConfigurationOptions: ChannelConfigurationOptions = {
|
||||
slowMode: {
|
||||
defaultDuration: parseInt(data.get('slow_mode_default_duration')?.toString() ?? '0')
|
||||
duration: parseInt(data.get('slow_mode_duration')?.toString() ?? '0')
|
||||
},
|
||||
bot: {
|
||||
enabled: data.get('bot') === '1',
|
||||
|
Reference in New Issue
Block a user