compose-validate: Use settings config value for policy check.

Updates the check in compose validate for the organization's
policy on sending private messages to use the code/value in
settings_config, instead of the number value.
This commit is contained in:
Lauryn Menard
2022-11-04 15:17:28 +01:00
committed by Tim Abbott
parent 6b4ab21562
commit f17030a802

View File

@@ -483,7 +483,8 @@ function validate_private_message() {
const user_ids = compose_pm_pill.get_user_ids();
if (
page_params.realm_private_message_policy === 2 && // Frontend check for for PRIVATE_MESSAGE_POLICY_DISABLED
page_params.realm_private_message_policy ===
settings_config.private_message_policy_values.disabled.code &&
(user_ids.length !== 1 || !people.get_by_user_id(user_ids[0]).is_bot)
) {
// Unless we're composing to a bot