2021-03-25 09:45:39 +01:00
|
|
|
import $ from "jquery";
|
|
|
|
|
2021-06-21 09:57:49 +02:00
|
|
|
import render_confirm_unstar_all_messages from "../templates/confirm_dialog/confirm_unstar_all_messages.hbs";
|
|
|
|
import render_confirm_unstar_all_messages_in_topic from "../templates/confirm_dialog/confirm_unstar_all_messages_in_topic.hbs";
|
2021-03-25 09:45:39 +01:00
|
|
|
|
|
|
|
import * as confirm_dialog from "./confirm_dialog";
|
2021-04-13 05:24:31 +02:00
|
|
|
import {$t_html} from "./i18n";
|
2021-03-25 09:45:39 +01:00
|
|
|
import * as message_flags from "./message_flags";
|
2021-04-02 04:52:34 +02:00
|
|
|
import * as stream_data from "./stream_data";
|
2021-03-25 09:45:39 +01:00
|
|
|
|
|
|
|
export function confirm_unstar_all_messages() {
|
|
|
|
const modal_parent = $(".left-sidebar-modal-holder");
|
|
|
|
const html_body = render_confirm_unstar_all_messages();
|
|
|
|
|
|
|
|
confirm_dialog.launch({
|
|
|
|
parent: modal_parent,
|
2021-04-13 05:24:31 +02:00
|
|
|
html_heading: $t_html({defaultMessage: "Unstar all messages"}),
|
2021-03-25 09:45:39 +01:00
|
|
|
html_body,
|
2021-07-05 15:11:23 +02:00
|
|
|
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
2021-03-25 09:45:39 +01:00
|
|
|
on_click: message_flags.unstar_all_messages,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
export function confirm_unstar_all_messages_in_topic(stream_id, topic) {
|
|
|
|
function on_click() {
|
|
|
|
message_flags.unstar_all_messages_in_topic(stream_id, topic);
|
|
|
|
}
|
|
|
|
|
2021-04-02 04:52:34 +02:00
|
|
|
const stream_name = stream_data.maybe_get_stream_name(stream_id);
|
|
|
|
if (stream_name === undefined) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-03-25 09:45:39 +01:00
|
|
|
const modal_parent = $(".left-sidebar-modal-holder");
|
|
|
|
const html_body = render_confirm_unstar_all_messages_in_topic({
|
2021-04-02 04:52:34 +02:00
|
|
|
stream_name,
|
2021-03-25 09:45:39 +01:00
|
|
|
topic,
|
|
|
|
});
|
|
|
|
|
|
|
|
confirm_dialog.launch({
|
|
|
|
parent: modal_parent,
|
2021-04-13 05:24:31 +02:00
|
|
|
html_heading: $t_html({defaultMessage: "Unstar messages in topic"}),
|
2021-03-25 09:45:39 +01:00
|
|
|
html_body,
|
2021-07-05 15:11:23 +02:00
|
|
|
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
2021-03-25 09:45:39 +01:00
|
|
|
on_click,
|
|
|
|
});
|
|
|
|
}
|