mirror of https://github.com/zulip/zulip.git
invites: Live update option to create new invitations.
Earlier option to create new invitations in right_sidebar, gear_menu and invitations panel does not get live update when the setting `who can invite others to realm` is changed. This commit make changes to do live update.
This commit is contained in:
parent
f67cef8885
commit
77c67464ba
|
@ -225,7 +225,7 @@ export function build_page() {
|
||||||
$("#settings_content .alert").removeClass("show");
|
$("#settings_content .alert").removeClass("show");
|
||||||
|
|
||||||
settings_bots.update_bot_settings_tip($("#admin-bot-settings-tip"), true);
|
settings_bots.update_bot_settings_tip($("#admin-bot-settings-tip"), true);
|
||||||
settings_invites.update_invite_users_setting_tip();
|
settings_invites.update_invite_user_panel();
|
||||||
insert_tip_box();
|
insert_tip_box();
|
||||||
|
|
||||||
$("#id_realm_bot_creation_policy").val(page_params.realm_bot_creation_policy);
|
$("#id_realm_bot_creation_policy").val(page_params.realm_bot_creation_policy);
|
||||||
|
|
|
@ -15,6 +15,7 @@ import * as composebox_typeahead from "./composebox_typeahead";
|
||||||
import * as dark_theme from "./dark_theme";
|
import * as dark_theme from "./dark_theme";
|
||||||
import * as emoji from "./emoji";
|
import * as emoji from "./emoji";
|
||||||
import * as emoji_picker from "./emoji_picker";
|
import * as emoji_picker from "./emoji_picker";
|
||||||
|
import * as gear_menu from "./gear_menu";
|
||||||
import * as giphy from "./giphy";
|
import * as giphy from "./giphy";
|
||||||
import * as hotspots from "./hotspots";
|
import * as hotspots from "./hotspots";
|
||||||
import * as left_sidebar_navigation_area from "./left_sidebar_navigation_area";
|
import * as left_sidebar_navigation_area from "./left_sidebar_navigation_area";
|
||||||
|
@ -70,6 +71,7 @@ import * as stream_ui_updates from "./stream_ui_updates";
|
||||||
import * as sub_store from "./sub_store";
|
import * as sub_store from "./sub_store";
|
||||||
import * as submessage from "./submessage";
|
import * as submessage from "./submessage";
|
||||||
import * as typing_events from "./typing_events";
|
import * as typing_events from "./typing_events";
|
||||||
|
import * as ui_init from "./ui_init";
|
||||||
import * as unread_ops from "./unread_ops";
|
import * as unread_ops from "./unread_ops";
|
||||||
import * as unread_ui from "./unread_ui";
|
import * as unread_ui from "./unread_ui";
|
||||||
import * as user_events from "./user_events";
|
import * as user_events from "./user_events";
|
||||||
|
@ -209,7 +211,7 @@ export function dispatch_normal_event(event) {
|
||||||
disallow_disposable_email_addresses: noop,
|
disallow_disposable_email_addresses: noop,
|
||||||
inline_image_preview: noop,
|
inline_image_preview: noop,
|
||||||
inline_url_embed_preview: noop,
|
inline_url_embed_preview: noop,
|
||||||
invite_to_realm_policy: settings_invites.update_invite_users_setting_tip,
|
invite_to_realm_policy: noop,
|
||||||
invite_required: noop,
|
invite_required: noop,
|
||||||
mandatory_topics: noop,
|
mandatory_topics: noop,
|
||||||
message_content_edit_limit_seconds: noop,
|
message_content_edit_limit_seconds: noop,
|
||||||
|
@ -246,6 +248,12 @@ export function dispatch_normal_event(event) {
|
||||||
window.electron_bridge.send_event("realm_name", event.value);
|
window.electron_bridge.send_event("realm_name", event.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.property === "invite_to_realm_policy") {
|
||||||
|
settings_invites.update_invite_user_panel();
|
||||||
|
ui_init.update_invite_user_option();
|
||||||
|
gear_menu.initialize();
|
||||||
|
}
|
||||||
|
|
||||||
const stream_creation_settings = [
|
const stream_creation_settings = [
|
||||||
"create_private_stream_policy",
|
"create_private_stream_policy",
|
||||||
"create_public_stream_policy",
|
"create_public_stream_policy",
|
||||||
|
|
|
@ -293,3 +293,12 @@ export function update_invite_users_setting_tip() {
|
||||||
$(".invite-user-settings-tip").show();
|
$(".invite-user-settings-tip").show();
|
||||||
$(".invite-user-settings-tip").text(tip_text);
|
$(".invite-user-settings-tip").text(tip_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function update_invite_user_panel() {
|
||||||
|
update_invite_users_setting_tip();
|
||||||
|
if (!settings_data.user_can_invite_others_to_realm()) {
|
||||||
|
$("#admin-invites-list .invite-user-link").hide();
|
||||||
|
} else {
|
||||||
|
$("#admin-invites-list .invite-user-link").show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -189,13 +189,21 @@ function initialize_left_sidebar() {
|
||||||
$("#left-sidebar-container").html(rendered_sidebar);
|
$("#left-sidebar-container").html(rendered_sidebar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function update_invite_user_option() {
|
||||||
|
if (!settings_data.user_can_invite_others_to_realm()) {
|
||||||
|
$("#right-sidebar .invite-user-link").hide();
|
||||||
|
} else {
|
||||||
|
$("#right-sidebar .invite-user-link").show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function initialize_right_sidebar() {
|
function initialize_right_sidebar() {
|
||||||
const rendered_sidebar = render_right_sidebar({
|
const rendered_sidebar = render_right_sidebar({
|
||||||
can_invite_others_to_realm: settings_data.user_can_invite_others_to_realm(),
|
|
||||||
realm_rendered_description: page_params.realm_rendered_description,
|
realm_rendered_description: page_params.realm_rendered_description,
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#right-sidebar-container").html(rendered_sidebar);
|
$("#right-sidebar-container").html(rendered_sidebar);
|
||||||
|
update_invite_user_option();
|
||||||
if (page_params.is_spectator) {
|
if (page_params.is_spectator) {
|
||||||
rendered_markdown.update_elements(
|
rendered_markdown.update_elements(
|
||||||
$(".right-sidebar .realm-description .rendered_markdown"),
|
$(".right-sidebar .realm-description .rendered_markdown"),
|
||||||
|
|
|
@ -23,9 +23,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-sidebar-shortcuts">
|
<div class="right-sidebar-shortcuts">
|
||||||
{{#if can_invite_others_to_realm}}
|
|
||||||
<a class="invite-user-link" role="button"><i class="fa fa-user-plus" aria-hidden="true"></i>{{t 'Invite more users' }}</a>
|
<a class="invite-user-link" role="button"><i class="fa fa-user-plus" aria-hidden="true"></i>{{t 'Invite more users' }}</a>
|
||||||
{{/if}}
|
|
||||||
<a id="sidebar-keyboard-shortcuts" data-overlay-trigger="keyboard-shortcuts" class="hidden-for-spectators">
|
<a id="sidebar-keyboard-shortcuts" data-overlay-trigger="keyboard-shortcuts" class="hidden-for-spectators">
|
||||||
<i class="fa fa-keyboard-o fa-2x tippy-zulip-tooltip" id="keyboard-icon" data-tooltip-template-id="keyboard-icon-tooltip-template"></i>
|
<i class="fa fa-keyboard-o fa-2x tippy-zulip-tooltip" id="keyboard-icon" data-tooltip-template-id="keyboard-icon-tooltip-template"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
{{#unless is_admin }}
|
{{#unless is_admin }}
|
||||||
<div class="tip">{{t "You can only view or manage invitations that you sent." }}</div>
|
<div class="tip">{{t "You can only view or manage invitations that you sent." }}</div>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
{{#if can_invite_others_to_realm}}
|
|
||||||
<a class="invite-user-link" role="button"><i class="fa fa-user-plus" aria-hidden="true"></i>{{t "Invite more users" }}</a>
|
<a class="invite-user-link" role="button"><i class="fa fa-user-plus" aria-hidden="true"></i>{{t "Invite more users" }}</a>
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<div class="settings_panel_list_header">
|
<div class="settings_panel_list_header">
|
||||||
<h3>{{t "Invites"}}</h3>
|
<h3>{{t "Invites"}}</h3>
|
||||||
|
|
|
@ -27,6 +27,7 @@ const compose_pm_pill = mock_esm("../src/compose_pm_pill");
|
||||||
const composebox_typeahead = mock_esm("../src/composebox_typeahead");
|
const composebox_typeahead = mock_esm("../src/composebox_typeahead");
|
||||||
const dark_theme = mock_esm("../src/dark_theme");
|
const dark_theme = mock_esm("../src/dark_theme");
|
||||||
const emoji_picker = mock_esm("../src/emoji_picker");
|
const emoji_picker = mock_esm("../src/emoji_picker");
|
||||||
|
const gear_menu = mock_esm("../src/gear_menu");
|
||||||
const hotspots = mock_esm("../src/hotspots");
|
const hotspots = mock_esm("../src/hotspots");
|
||||||
const linkifiers = mock_esm("../src/linkifiers");
|
const linkifiers = mock_esm("../src/linkifiers");
|
||||||
const message_events = mock_esm("../src/message_events");
|
const message_events = mock_esm("../src/message_events");
|
||||||
|
@ -76,6 +77,7 @@ mock_esm("../src/left_sidebar_navigation_area", {
|
||||||
update_scheduled_messages_row() {},
|
update_scheduled_messages_row() {},
|
||||||
});
|
});
|
||||||
const typing_events = mock_esm("../src/typing_events");
|
const typing_events = mock_esm("../src/typing_events");
|
||||||
|
const ui_init = mock_esm("../src/ui_init");
|
||||||
const unread_ops = mock_esm("../src/unread_ops");
|
const unread_ops = mock_esm("../src/unread_ops");
|
||||||
const unread_ui = mock_esm("../src/unread_ui");
|
const unread_ui = mock_esm("../src/unread_ui");
|
||||||
const user_events = mock_esm("../src/user_events");
|
const user_events = mock_esm("../src/user_events");
|
||||||
|
@ -415,7 +417,9 @@ run_test("realm settings", ({override}) => {
|
||||||
|
|
||||||
override(settings_org, "sync_realm_settings", noop);
|
override(settings_org, "sync_realm_settings", noop);
|
||||||
override(settings_bots, "update_bot_permissions_ui", noop);
|
override(settings_bots, "update_bot_permissions_ui", noop);
|
||||||
override(settings_invites, "update_invite_users_setting_tip", noop);
|
override(settings_invites, "update_invite_user_panel", noop);
|
||||||
|
override(ui_init, "update_invite_user_option", noop);
|
||||||
|
override(gear_menu, "initialize", noop);
|
||||||
override(notifications, "redraw_title", noop);
|
override(notifications, "redraw_title", noop);
|
||||||
|
|
||||||
function test_electron_dispatch(event, fake_send_event) {
|
function test_electron_dispatch(event, fake_send_event) {
|
||||||
|
|
Loading…
Reference in New Issue