Fix: resetting validationError on update.
This commit is contained in:
parent
1d943716dd
commit
63d8e9789e
@ -61,6 +61,17 @@ export class ChannelConfigurationElement extends LivechatElement {
|
||||
this.requestUpdate()
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the validation errors.
|
||||
* @param ev the vent
|
||||
*/
|
||||
public resetValidation (_ev?: Event): void {
|
||||
if (this.validationError) {
|
||||
this.validationError = undefined
|
||||
this.requestUpdate('_validationError')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the channel configuration.
|
||||
* @param event event
|
||||
|
@ -71,6 +71,17 @@ export class ChannelEmojisElement extends LivechatElement {
|
||||
this.requestUpdate()
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the validation errors.
|
||||
* @param ev the vent
|
||||
*/
|
||||
public resetValidation (_ev?: Event): void {
|
||||
if (this.validationError) {
|
||||
this.validationError = undefined
|
||||
this.requestUpdate('_validationError')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the emojis form.
|
||||
* @param ev event
|
||||
|
@ -126,7 +126,7 @@ export function tplChannelConfiguration (el: ChannelConfigurationElement): Templ
|
||||
</livechat-help-button>
|
||||
</p>
|
||||
|
||||
<form livechat-configuration-channel-options role="form" @submit=${el.saveConfig}>
|
||||
<form livechat-configuration-channel-options role="form" @submit=${el.saveConfig} @change=${el.resetValidation}>
|
||||
<livechat-configuration-section-header
|
||||
.label=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_SLOW_MODE_LABEL)}
|
||||
.description=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_SLOW_MODE_DESC, true)}
|
||||
@ -230,6 +230,7 @@ export function tplChannelConfiguration (el: ChannelConfigurationElement): Templ
|
||||
.validationPrefix=${'bot.forbiddenWords'}
|
||||
.rows=${el.channelConfiguration?.configuration.bot.forbiddenWords}
|
||||
@update=${(e: CustomEvent) => {
|
||||
el.resetValidation(e)
|
||||
if (el.channelConfiguration) {
|
||||
el.channelConfiguration.configuration.bot.forbiddenWords = e.detail
|
||||
el.requestUpdate('channelConfiguration')
|
||||
@ -251,6 +252,7 @@ export function tplChannelConfiguration (el: ChannelConfigurationElement): Templ
|
||||
.validationPrefix=${'bot.quotes'}
|
||||
.rows=${el.channelConfiguration?.configuration.bot.quotes}
|
||||
@update=${(e: CustomEvent) => {
|
||||
el.resetValidation(e)
|
||||
if (el.channelConfiguration) {
|
||||
el.channelConfiguration.configuration.bot.quotes = e.detail
|
||||
el.requestUpdate('channelConfiguration')
|
||||
@ -272,6 +274,7 @@ export function tplChannelConfiguration (el: ChannelConfigurationElement): Templ
|
||||
.validationPrefix=${'bot.commands'}
|
||||
.rows=${el.channelConfiguration?.configuration.bot.commands}
|
||||
@update=${(e: CustomEvent) => {
|
||||
el.resetValidation(e)
|
||||
if (el.channelConfiguration) {
|
||||
el.channelConfiguration.configuration.bot.commands = e.detail
|
||||
el.requestUpdate('channelConfiguration')
|
||||
|
@ -52,7 +52,7 @@ export function tplChannelEmojis (el: ChannelEmojisElement): TemplateResult {
|
||||
</p>
|
||||
|
||||
|
||||
<form role="form" @submit=${el.saveEmojis}>
|
||||
<form role="form" @submit=${el.saveEmojis} @change=${el.resetValidation}>
|
||||
<div class="peertube-plugin-livechat-configuration-actions">
|
||||
${
|
||||
el.channelEmojisConfiguration?.emojis?.customEmojis?.length
|
||||
@ -88,6 +88,7 @@ export function tplChannelEmojis (el: ChannelEmojisElement): TemplateResult {
|
||||
.validationPrefix=${'emojis'}
|
||||
.rows=${el.channelEmojisConfiguration?.emojis.customEmojis}
|
||||
@update=${(e: CustomEvent) => {
|
||||
el.resetValidation(e)
|
||||
if (el.channelEmojisConfiguration) {
|
||||
el.channelEmojisConfiguration.emojis.customEmojis = e.detail
|
||||
// Fixing missing ':' for shortnames:
|
||||
|
Loading…
Reference in New Issue
Block a user