From 9b905d7b3b1f1a718b4974603f117742dc61c2a6 Mon Sep 17 00:00:00 2001 From: anbebe <58171814+anbebe@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:36:23 +0100 Subject: [PATCH] Add warning text for public access setting (#4350) --- ...ting-settings-group-detail-field.component.html | 9 ++++++++- ...eeting-settings-group-detail-field.component.ts | 12 ++++++++++++ .../meeting-settings-definitions.ts | 14 +++++++++++++- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/client/src/app/site/pages/meetings/pages/meeting-settings/pages/meeting-settings-group-detail/components/meeting-settings-group-detail-field/meeting-settings-group-detail-field.component.html b/client/src/app/site/pages/meetings/pages/meeting-settings/pages/meeting-settings-group-detail/components/meeting-settings-group-detail-field/meeting-settings-group-detail-field.component.html index 34cee03cea..19f56cb608 100644 --- a/client/src/app/site/pages/meetings/pages/meeting-settings/pages/meeting-settings-group-detail/components/meeting-settings-group-detail-field/meeting-settings-group-detail-field.component.html +++ b/client/src/app/site/pages/meetings/pages/meeting-settings/pages/meeting-settings-group-detail/components/meeting-settings-group-detail-field/meeting-settings-group-detail-field.component.html @@ -95,7 +95,14 @@
{{ setting.label | translate }} @if (setting.helpText) { - {{ setting.helpText | translate }} + + {{ setting.helpText | translate }} + + } + @if (getWarning()) { + + {{ setting.warnText | translate }} + } @if (error) {
{{ error }}
diff --git a/client/src/app/site/pages/meetings/pages/meeting-settings/pages/meeting-settings-group-detail/components/meeting-settings-group-detail-field/meeting-settings-group-detail-field.component.ts b/client/src/app/site/pages/meetings/pages/meeting-settings/pages/meeting-settings-group-detail/components/meeting-settings-group-detail-field/meeting-settings-group-detail-field.component.ts index 79b76f94be..7c3d0b6772 100644 --- a/client/src/app/site/pages/meetings/pages/meeting-settings/pages/meeting-settings-group-detail/components/meeting-settings-group-detail-field/meeting-settings-group-detail-field.component.ts +++ b/client/src/app/site/pages/meetings/pages/meeting-settings/pages/meeting-settings-group-detail/components/meeting-settings-group-detail-field/meeting-settings-group-detail-field.component.ts @@ -274,6 +274,18 @@ export class MeetingSettingsGroupDetailFieldComponent extends BaseComponent impl this.cd.detach(); } + /** + * Checks if a warning should be given + * + */ + public getWarning(): boolean { + if (this.setting.warn) { + return this.setting.warn(this.orgaSettings); + } else { + return false; + } + } + public getRestrictedValue(value: T): T { if (this.setting.restrictionFn) { return this.setting.restrictionFn(this.orgaSettings, value); diff --git a/client/src/app/site/pages/meetings/services/meeting-settings-definition.service/meeting-settings-definitions.ts b/client/src/app/site/pages/meetings/services/meeting-settings-definition.service/meeting-settings-definitions.ts index 2647b28af6..d5fdb3775f 100644 --- a/client/src/app/site/pages/meetings/services/meeting-settings-definition.service/meeting-settings-definitions.ts +++ b/client/src/app/site/pages/meetings/services/meeting-settings-definition.service/meeting-settings-definitions.ts @@ -60,6 +60,7 @@ export interface SettingsInput { // alternative to `choices`; overwrites `choices` if both are given choicesFunc?: ChoicesFunctionDefinition; helpText?: string; // default: "" + warnText?: string; // default: "" indentation?: number; // default: 0. Indents the input field by the given amount to simulate nested settings validators?: ValidatorFn[]; // default: [] automaticChangesSetting?: SettingsItemAutomaticChangeSetting; @@ -88,6 +89,13 @@ export interface SettingsInput { * @returns whether to disable the setting or not */ forbidden?: (meetingView: ViewMeeting) => boolean; + /** + * A function to conditionally give a warning depending on used organization's settings + * + * @param orgaSettings: The `OrganizationSettingsService` has to be passed, because it is not injected in the + * settings definitions + */ + warn?: (orgaSettings: OrganizationSettingsService) => boolean; hide?: boolean; // Hide the setting in the settings view } @@ -207,7 +215,11 @@ export const meetingSettings: SettingsGroup[] = fillInSettingsDefaults([ type: `boolean`, helpText: _( `Enables public access to this meeting without login data. Permissions can be set after activation in the new group 'Public'.` - ) + ), + warnText: _( + `The public access setting is deactivated for the organization. Please contact your admins or hosting providers to activate the setting.` + ), + warn: orgaSettings => !orgaSettings.instant(`enable_anonymous`) } ] },