Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning text for public access setting #4350

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,14 @@
<div>
<mat-checkbox formControlName="value">{{ setting.label | translate }}</mat-checkbox>
@if (setting.helpText) {
<mat-hint class="hint-checkbox">{{ setting.helpText | translate }}</mat-hint>
<mat-hint class="hint-checkbox settings-form-group">
{{ setting.helpText | translate }}
</mat-hint>
}
@if (getWarning()) {
<mat-hint class="hint-checkbox red-warning-text">
{{ setting.warnText | translate }}
</mat-hint>
}
@if (error) {
<div class="error">{{ error }}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(value: T): T {
if (this.setting.restrictionFn) {
return this.setting.restrictionFn(this.orgaSettings, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export interface SettingsInput<V = any> {
// alternative to `choices`; overwrites `choices` if both are given
choicesFunc?: ChoicesFunctionDefinition<V>;
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<V>;
Expand Down Expand Up @@ -88,6 +89,13 @@ export interface SettingsInput<V = any> {
* @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
}
Expand Down Expand Up @@ -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`)
}
]
},
Expand Down