Moderation delay WIP (#132):
* default channel value for moderation delay
This commit is contained in:
@ -219,6 +219,41 @@ export function tplChannelConfiguration (el: ChannelConfigurationElement): Templ
|
||||
${el.renderFeedback('peertube-livechat-slowmode-duration-feedback', 'slowMode.duration')}
|
||||
</div>
|
||||
|
||||
<livechat-configuration-section-header
|
||||
.label=${ptTr(LOC_MODERATION_DELAY)}
|
||||
.description=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_MODERATION_DELAY_DESC, true)}
|
||||
.helpPage=${'documentation/user/streamers/moderation_delay'}>
|
||||
</livechat-configuration-section-header>
|
||||
<div class="form-group">
|
||||
<label>
|
||||
${ptTr(LOC_MODERATION_DELAY)}
|
||||
<input
|
||||
type="number"
|
||||
name="moderation_delay"
|
||||
class=${classMap(
|
||||
Object.assign(
|
||||
{ 'form-control': true },
|
||||
el.getInputValidationClass('moderation.delay')
|
||||
)
|
||||
)}
|
||||
min="0"
|
||||
max="60"
|
||||
id="peertube-livechat-moderation-delay"
|
||||
aria-describedby="peertube-livechat-moderation-delay-feedback"
|
||||
@input=${(event: InputEvent) => {
|
||||
if (event?.target && el.channelConfiguration) {
|
||||
el.channelConfiguration.configuration.moderation.delay =
|
||||
Number((event.target as HTMLInputElement).value)
|
||||
}
|
||||
el.requestUpdate('channelConfiguration')
|
||||
}
|
||||
}
|
||||
value="${el.channelConfiguration?.configuration.moderation.delay ?? ''}"
|
||||
/>
|
||||
</label>
|
||||
${el.renderFeedback('peertube-livechat-moderation-delay-feedback', 'moderation.delay')}
|
||||
</div>
|
||||
|
||||
<livechat-configuration-section-header
|
||||
.label=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_BOT_OPTIONS_TITLE)}
|
||||
.description=${''}
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user