compose: Move call button display functions to compose_call_ui.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2023-10-06 00:31:19 -07:00
committed by Tim Abbott
parent 9c70f92514
commit 833a15e121
3 changed files with 20 additions and 21 deletions

View File

@@ -8,7 +8,6 @@ import render_success_message_scheduled_banner from "../templates/compose_banner
import * as channel from "./channel"; import * as channel from "./channel";
import * as compose_banner from "./compose_banner"; import * as compose_banner from "./compose_banner";
import * as compose_call from "./compose_call";
import * as compose_state from "./compose_state"; import * as compose_state from "./compose_state";
import * as compose_ui from "./compose_ui"; import * as compose_ui from "./compose_ui";
import * as compose_validate from "./compose_validate"; import * as compose_validate from "./compose_validate";
@@ -31,23 +30,6 @@ import * as zcommand from "./zcommand";
// Docs: https://zulip.readthedocs.io/en/latest/subsystems/sending-messages.html // Docs: https://zulip.readthedocs.io/en/latest/subsystems/sending-messages.html
export function update_audio_and_video_chat_button_display() {
update_audio_chat_button_display();
update_video_chat_button_display();
}
export function update_video_chat_button_display() {
const show_video_chat_button = compose_call.compute_show_video_chat_button();
$("#below-compose-content .video_link").toggle(show_video_chat_button);
$(".message-edit-feature-group .video_link").toggle(show_video_chat_button);
}
export function update_audio_chat_button_display() {
const show_audio_chat_button = compose_call.compute_show_audio_chat_button();
$("#below-compose-content .audio_link").toggle(show_audio_chat_button);
$(".message-edit-feature-group .audio_link").toggle(show_audio_chat_button);
}
export function clear_invites() { export function clear_invites() {
$( $(
`#compose_banners .${CSS.escape(compose_banner.CLASSNAMES.recipient_not_subscribed)}`, `#compose_banners .${CSS.escape(compose_banner.CLASSNAMES.recipient_not_subscribed)}`,

View File

@@ -10,6 +10,23 @@ import * as rows from "./rows";
import * as ui_report from "./ui_report"; import * as ui_report from "./ui_report";
import * as util from "./util"; import * as util from "./util";
export function update_audio_and_video_chat_button_display() {
update_audio_chat_button_display();
update_video_chat_button_display();
}
export function update_video_chat_button_display() {
const show_video_chat_button = compose_call.compute_show_video_chat_button();
$("#below-compose-content .video_link").toggle(show_video_chat_button);
$(".message-edit-feature-group .video_link").toggle(show_video_chat_button);
}
export function update_audio_chat_button_display() {
const show_audio_chat_button = compose_call.compute_show_audio_chat_button();
$("#below-compose-content .audio_link").toggle(show_audio_chat_button);
$(".message-edit-feature-group .audio_link").toggle(show_audio_chat_button);
}
function insert_video_call_url(url, target_textarea) { function insert_video_call_url(url, target_textarea) {
const link_text = $t({defaultMessage: "Join video call."}); const link_text = $t({defaultMessage: "Join video call."});
compose_ui.insert_syntax_and_focus(`[${link_text}](${url})`, target_textarea, "block", 1); compose_ui.insert_syntax_and_focus(`[${link_text}](${url})`, target_textarea, "block", 1);

View File

@@ -8,8 +8,8 @@ import * as blueslip from "./blueslip";
import * as bot_data from "./bot_data"; import * as bot_data from "./bot_data";
import * as browser_history from "./browser_history"; import * as browser_history from "./browser_history";
import {buddy_list} from "./buddy_list"; import {buddy_list} from "./buddy_list";
import * as compose from "./compose";
import * as compose_call from "./compose_call"; import * as compose_call from "./compose_call";
import * as compose_call_ui from "./compose_call_ui";
import * as compose_pm_pill from "./compose_pm_pill"; import * as compose_pm_pill from "./compose_pm_pill";
import * as compose_recipient from "./compose_recipient"; import * as compose_recipient from "./compose_recipient";
import * as compose_state from "./compose_state"; import * as compose_state from "./compose_state";
@@ -235,8 +235,8 @@ export function dispatch_normal_event(event) {
enable_spectator_access: noop, enable_spectator_access: noop,
signup_notifications_stream_id: noop, signup_notifications_stream_id: noop,
emails_restricted_to_domains: noop, emails_restricted_to_domains: noop,
video_chat_provider: compose.update_audio_and_video_chat_button_display, video_chat_provider: compose_call_ui.update_audio_and_video_chat_button_display,
jitsi_server_url: compose.update_audio_and_video_chat_button_display, jitsi_server_url: compose_call_ui.update_audio_and_video_chat_button_display,
giphy_rating: giphy.update_giphy_rating, giphy_rating: giphy.update_giphy_rating,
waiting_period_threshold: noop, waiting_period_threshold: noop,
want_advertise_in_communities_directory: noop, want_advertise_in_communities_directory: noop,