diff --git a/CHANGELOG.md b/CHANGELOG.md index 39f1ca7e..e7c54f17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### New features * #233: new option to [mute anonymous users](https://livingston.frama.io/peertube-plugin-livechat/fr/documentation/user/streamers/moderation/). +* #18: terms & conditions. You can configure terms&conditions on your instance that will be shown to each joining users. Streamers can also add terms&conditions in their channels options. ## 10.1.2 diff --git a/client/@types/global.d.ts b/client/@types/global.d.ts index d398383c..1398da00 100644 --- a/client/@types/global.d.ts +++ b/client/@types/global.d.ts @@ -83,6 +83,8 @@ declare const LOC_LIVECHAT_CONFIGURATION_CHANNEL_BOT_NICKNAME: string declare const LOC_LIVECHAT_CONFIGURATION_CHANNEL_FOR_MORE_INFO: string declare const LOC_LIVECHAT_CONFIGURATION_CHANNEL_MUTE_ANONYMOUS_LABEL: string declare const LOC_LIVECHAT_CONFIGURATION_CHANNEL_MUTE_ANONYMOUS_DESC: string +declare const LOC_LIVECHAT_CONFIGURATION_CHANNEL_TERMS_LABEL: string +declare const LOC_LIVECHAT_CONFIGURATION_CHANNEL_TERMS_DESC: string declare const LOC_VALIDATION_ERROR: string declare const LOC_TOO_MANY_ENTRIES: string @@ -93,6 +95,7 @@ declare const LOC_INVALID_VALUE_WRONG_FORMAT: string declare const LOC_INVALID_VALUE_NOT_IN_RANGE: string declare const LOC_INVALID_VALUE_FILE_TOO_BIG: string declare const LOC_INVALID_VALUE_DUPLICATE: string +declare const LOC_INVALID_VALUE_TOO_LONG: string declare const LOC_CHATROOM_NOT_ACCESSIBLE: string diff --git a/client/common/configuration/elements/channel-configuration.ts b/client/common/configuration/elements/channel-configuration.ts index a5e5bb14..7e6edd66 100644 --- a/client/common/configuration/elements/channel-configuration.ts +++ b/client/common/configuration/elements/channel-configuration.ts @@ -14,6 +14,7 @@ import { customElement, property, state } from 'lit/decorators.js' import { ptTr } from '../../lib/directives/translation' import { Task } from '@lit/task' import { provide } from '@lit/context' +import { channelTermsMaxLength } from 'shared/lib/constants' @customElement('livechat-channel-configuration') export class ChannelConfigurationElement extends LivechatElement { @@ -51,6 +52,10 @@ export class ChannelConfigurationElement extends LivechatElement { }) } + public termsMaxLength (): number { + return channelTermsMaxLength + } + /** * Resets the form by reloading data from backend. */ @@ -120,7 +125,11 @@ export class ChannelConfigurationElement extends LivechatElement { const validationErrorTypes: ValidationErrorType[] | undefined = this.validationError?.properties[`${propertyName}`] ?? undefined + // FIXME: this code is duplicated in dymamic table form if (validationErrorTypes && validationErrorTypes.length !== 0) { + if (validationErrorTypes.includes(ValidationErrorType.Missing)) { + errorMessages.push(html`${ptTr(LOC_INVALID_VALUE_MISSING)}`) + } if (validationErrorTypes.includes(ValidationErrorType.WrongType)) { errorMessages.push(html`${ptTr(LOC_INVALID_VALUE_WRONG_TYPE)}`) } @@ -130,6 +139,9 @@ export class ChannelConfigurationElement extends LivechatElement { if (validationErrorTypes.includes(ValidationErrorType.NotInRange)) { errorMessages.push(html`${ptTr(LOC_INVALID_VALUE_NOT_IN_RANGE)}`) } + if (validationErrorTypes.includes(ValidationErrorType.TooLong)) { + errorMessages.push(html`${ptTr(LOC_INVALID_VALUE_TOO_LONG)}`) + } return html`