settings: Fix email notification permission.

Added `message_content_in_email_notifications` to the
`disabled_notification_settings` object to keep track of the setting.
Also added a tooltip message to display when the checkbox is disabled,
indicating that the setting is controlled by the organization.

Fixes: #27262.
This commit is contained in:
Maneesh Shukla 2024-10-21 00:56:20 +05:30 committed by Tim Abbott
parent 9771528e28
commit 81836303d4
3 changed files with 22 additions and 0 deletions

View File

@ -862,6 +862,7 @@ export type AllNotifications = {
disabled_notification_settings: {
push_notifications: boolean;
enable_online_push_notifications: boolean;
message_content_in_email_notifications: boolean;
};
};
@ -898,6 +899,8 @@ export const all_notifications = (settings_object: Settings): AllNotifications =
disabled_notification_settings: {
push_notifications: !realm.realm_push_notifications_enabled,
enable_online_push_notifications: !realm.realm_push_notifications_enabled,
message_content_in_email_notifications:
!realm.realm_message_content_allowed_in_email_notifications,
},
});

View File

@ -531,6 +531,24 @@ export function initialize(): void {
},
});
tippy.delegate("body", {
target: "#user_message_content_in_email_notifications_label",
onShow(instance) {
if ($("#user_message_content_in_email_notifications").prop("disabled")) {
instance.setContent(
$t({
defaultMessage:
"Including message content in message notification emails is not allowed in this organization.",
}),
);
return undefined;
}
instance.destroy();
return false;
},
appendTo: () => document.body,
});
tippy.delegate("body", {
target: ".views-tooltip-target",
onShow(instance) {

View File

@ -212,6 +212,7 @@
setting_name=this
is_checked=(lookup ../settings_object this)
label=(lookup ../settings_label this)
is_disabled=(lookup ../disabled_notification_settings this)
prefix=../prefix}}
{{/each}}
</div>