2021-04-15 02:59:34 +02:00
|
|
|
import $ from "jquery";
|
|
|
|
|
2021-05-05 05:51:55 +02:00
|
|
|
import * as compose_actions from "./compose_actions";
|
2021-04-15 02:59:34 +02:00
|
|
|
import * as message_lists from "./message_lists";
|
2021-05-05 05:51:55 +02:00
|
|
|
import * as popovers from "./popovers";
|
2021-04-15 02:59:34 +02:00
|
|
|
|
2021-03-18 13:57:28 +01:00
|
|
|
export function update_reply_recipient_label(message) {
|
|
|
|
message = message || message_lists.current.selected_message();
|
2021-04-15 02:59:34 +02:00
|
|
|
let recipient_label = "";
|
|
|
|
if (message) {
|
|
|
|
if (message.stream && message.topic) {
|
|
|
|
recipient_label = "#" + message.stream + " > " + message.topic;
|
|
|
|
} else if (message.display_reply_to) {
|
|
|
|
recipient_label = message.display_reply_to;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$(".compose_reply_button_recipient_label").text(recipient_label);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function initialize() {
|
|
|
|
// When the message selection changes, change the label on the Reply button.
|
|
|
|
$(document).on("message_selected.zulip", () => {
|
|
|
|
update_reply_recipient_label();
|
|
|
|
});
|
2021-05-05 05:51:55 +02:00
|
|
|
|
|
|
|
// Click handlers for buttons in the compose compose box.
|
|
|
|
$("body").on("click", ".compose_stream_button", () => {
|
|
|
|
popovers.hide_mobile_message_buttons_popover();
|
|
|
|
compose_actions.start("stream", {trigger: "new topic button"});
|
|
|
|
});
|
|
|
|
|
|
|
|
$("body").on("click", ".compose_private_button", () => {
|
|
|
|
popovers.hide_mobile_message_buttons_popover();
|
|
|
|
compose_actions.start("private");
|
|
|
|
});
|
|
|
|
|
|
|
|
$("body").on("click", ".compose_mobile_stream_button", () => {
|
|
|
|
popovers.hide_mobile_message_buttons_popover();
|
|
|
|
compose_actions.start("stream", {trigger: "new topic button"});
|
|
|
|
});
|
|
|
|
|
|
|
|
$("body").on("click", ".compose_mobile_private_button", () => {
|
|
|
|
popovers.hide_mobile_message_buttons_popover();
|
|
|
|
compose_actions.start("private");
|
|
|
|
});
|
|
|
|
|
|
|
|
$("body").on("click", ".compose_reply_button", () => {
|
|
|
|
compose_actions.respond_to_message({trigger: "reply button"});
|
|
|
|
});
|
2021-04-15 02:59:34 +02:00
|
|
|
}
|