mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 08:56:10 +00:00
compose: Allow the user to direct message bots despite of policy.
After the changes in #25572, users were no longer able to start a direct message with bots if the organization disabled direct messages. However, we should allow direct messages to bots regardless of the policy because it's a useful interface for users to interact with various classes of bots. user_ids_string_to_ids_array was also modified to prevent cases where the split function returned an array of [0] rather than [] when dealing with a empty id string of "". Fixes: #21896.
This commit is contained in:
@@ -15,6 +15,7 @@ import * as dropdown_widget from "./dropdown_widget";
|
||||
import {$t} from "./i18n";
|
||||
import * as narrow_state from "./narrow_state";
|
||||
import {page_params} from "./page_params";
|
||||
import * as people from "./people";
|
||||
import * as settings_config from "./settings_config";
|
||||
import * as stream_bar from "./stream_bar";
|
||||
import * as stream_data from "./stream_data";
|
||||
@@ -110,10 +111,8 @@ export function update_on_recipient_change() {
|
||||
|
||||
export function get_posting_policy_error_message() {
|
||||
if (selected_recipient_id === "direct") {
|
||||
if (
|
||||
page_params.realm_private_message_policy ===
|
||||
settings_config.private_message_policy_values.disabled.code
|
||||
) {
|
||||
const recipients = compose_pm_pill.get_user_ids_string();
|
||||
if (!people.user_can_direct_message(recipients)) {
|
||||
return $t({
|
||||
defaultMessage: "Direct messages are disabled in this organization.",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user