mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
settings_data: Add 'user_can_create_streams' helper.
This commit adds 'user_can_create_streams' helper which is used to check whether user can create streams or not and replaces all the instances of 'page_params.can_create_streams'. This change helps us to remove the complex logic of updating 'page_params.can_create_streams' for 'realm_update' event in 'server_events_dispatch.js', as we will always get the updated values from the added helper for checking whether the users can create streams or not.
This commit is contained in:
@@ -32,6 +32,7 @@ import * as popovers from "./popovers";
|
||||
import * as reactions from "./reactions";
|
||||
import * as recent_topics from "./recent_topics";
|
||||
import * as search from "./search";
|
||||
import * as settings_data from "./settings_data";
|
||||
import * as stream_list from "./stream_list";
|
||||
import * as stream_popover from "./stream_popover";
|
||||
import * as subs from "./subs";
|
||||
@@ -724,7 +725,11 @@ export function process_hotkey(e, hotkey) {
|
||||
subs.view_stream();
|
||||
return true;
|
||||
}
|
||||
if (event_name === "n_key" && overlays.streams_open() && page_params.can_create_streams) {
|
||||
if (
|
||||
event_name === "n_key" &&
|
||||
overlays.streams_open() &&
|
||||
settings_data.user_can_create_streams()
|
||||
) {
|
||||
subs.open_create_stream();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user