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()
|
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.
|
* Saves the channel configuration.
|
||||||
* @param event event
|
* @param event event
|
||||||
|
@ -71,6 +71,17 @@ export class ChannelEmojisElement extends LivechatElement {
|
|||||||
this.requestUpdate()
|
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.
|
* Saves the emojis form.
|
||||||
* @param ev event
|
* @param ev event
|
||||||
|
@ -126,7 +126,7 @@ export function tplChannelConfiguration (el: ChannelConfigurationElement): Templ
|
|||||||
</livechat-help-button>
|
</livechat-help-button>
|
||||||
</p>
|
</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
|
<livechat-configuration-section-header
|
||||||
.label=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_SLOW_MODE_LABEL)}
|
.label=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_SLOW_MODE_LABEL)}
|
||||||
.description=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_SLOW_MODE_DESC, true)}
|
.description=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_SLOW_MODE_DESC, true)}
|
||||||
@ -230,6 +230,7 @@ export function tplChannelConfiguration (el: ChannelConfigurationElement): Templ
|
|||||||
.validationPrefix=${'bot.forbiddenWords'}
|
.validationPrefix=${'bot.forbiddenWords'}
|
||||||
.rows=${el.channelConfiguration?.configuration.bot.forbiddenWords}
|
.rows=${el.channelConfiguration?.configuration.bot.forbiddenWords}
|
||||||
@update=${(e: CustomEvent) => {
|
@update=${(e: CustomEvent) => {
|
||||||
|
el.resetValidation(e)
|
||||||
if (el.channelConfiguration) {
|
if (el.channelConfiguration) {
|
||||||
el.channelConfiguration.configuration.bot.forbiddenWords = e.detail
|
el.channelConfiguration.configuration.bot.forbiddenWords = e.detail
|
||||||
el.requestUpdate('channelConfiguration')
|
el.requestUpdate('channelConfiguration')
|
||||||
@ -251,6 +252,7 @@ export function tplChannelConfiguration (el: ChannelConfigurationElement): Templ
|
|||||||
.validationPrefix=${'bot.quotes'}
|
.validationPrefix=${'bot.quotes'}
|
||||||
.rows=${el.channelConfiguration?.configuration.bot.quotes}
|
.rows=${el.channelConfiguration?.configuration.bot.quotes}
|
||||||
@update=${(e: CustomEvent) => {
|
@update=${(e: CustomEvent) => {
|
||||||
|
el.resetValidation(e)
|
||||||
if (el.channelConfiguration) {
|
if (el.channelConfiguration) {
|
||||||
el.channelConfiguration.configuration.bot.quotes = e.detail
|
el.channelConfiguration.configuration.bot.quotes = e.detail
|
||||||
el.requestUpdate('channelConfiguration')
|
el.requestUpdate('channelConfiguration')
|
||||||
@ -272,6 +274,7 @@ export function tplChannelConfiguration (el: ChannelConfigurationElement): Templ
|
|||||||
.validationPrefix=${'bot.commands'}
|
.validationPrefix=${'bot.commands'}
|
||||||
.rows=${el.channelConfiguration?.configuration.bot.commands}
|
.rows=${el.channelConfiguration?.configuration.bot.commands}
|
||||||
@update=${(e: CustomEvent) => {
|
@update=${(e: CustomEvent) => {
|
||||||
|
el.resetValidation(e)
|
||||||
if (el.channelConfiguration) {
|
if (el.channelConfiguration) {
|
||||||
el.channelConfiguration.configuration.bot.commands = e.detail
|
el.channelConfiguration.configuration.bot.commands = e.detail
|
||||||
el.requestUpdate('channelConfiguration')
|
el.requestUpdate('channelConfiguration')
|
||||||
|
@ -52,7 +52,7 @@ export function tplChannelEmojis (el: ChannelEmojisElement): TemplateResult {
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<form role="form" @submit=${el.saveEmojis}>
|
<form role="form" @submit=${el.saveEmojis} @change=${el.resetValidation}>
|
||||||
<div class="peertube-plugin-livechat-configuration-actions">
|
<div class="peertube-plugin-livechat-configuration-actions">
|
||||||
${
|
${
|
||||||
el.channelEmojisConfiguration?.emojis?.customEmojis?.length
|
el.channelEmojisConfiguration?.emojis?.customEmojis?.length
|
||||||
@ -88,6 +88,7 @@ export function tplChannelEmojis (el: ChannelEmojisElement): TemplateResult {
|
|||||||
.validationPrefix=${'emojis'}
|
.validationPrefix=${'emojis'}
|
||||||
.rows=${el.channelEmojisConfiguration?.emojis.customEmojis}
|
.rows=${el.channelEmojisConfiguration?.emojis.customEmojis}
|
||||||
@update=${(e: CustomEvent) => {
|
@update=${(e: CustomEvent) => {
|
||||||
|
el.resetValidation(e)
|
||||||
if (el.channelEmojisConfiguration) {
|
if (el.channelEmojisConfiguration) {
|
||||||
el.channelEmojisConfiguration.emojis.customEmojis = e.detail
|
el.channelEmojisConfiguration.emojis.customEmojis = e.detail
|
||||||
// Fixing missing ':' for shortnames:
|
// Fixing missing ':' for shortnames:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user