mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 08:26:11 +00:00
schedule: Remove 'Schedule' state of compose box.
Fixes #25340 This means that we now schedule the message simply after selecting time if the message is valid. Also, editing scheduled messages will now delete the scheduled message and open compose with scheduled message.
This commit is contained in:
@@ -188,7 +188,7 @@ export function clear_compose_box() {
|
||||
compose_banner.clear_errors();
|
||||
compose_banner.clear_warnings();
|
||||
compose_ui.hide_compose_spinner();
|
||||
reset_compose_scheduling_state();
|
||||
popover_menus.reset_selected_schedule_time();
|
||||
}
|
||||
|
||||
export function send_message_success(local_id, message_id, locally_echoed) {
|
||||
@@ -269,7 +269,6 @@ export function send_message(request = create_message_object()) {
|
||||
}
|
||||
|
||||
transmit.send_message(request, success, error);
|
||||
scheduled_messages.delete_scheduled_message_if_sent_directly();
|
||||
server_events.assert_get_events_running(
|
||||
"Restarting get_events because it was not running during send",
|
||||
);
|
||||
@@ -298,7 +297,7 @@ export function enter_with_preview_open(ctrl_pressed = false) {
|
||||
// Common entrypoint for asking the server to send the message
|
||||
// currently drafted in the compose box, including for scheduled
|
||||
// messages.
|
||||
export function finish() {
|
||||
export function finish(from_do_schedule_message = false) {
|
||||
if (compose_ui.compose_spinner_visible) {
|
||||
// Avoid sending a message twice in parallel in races where
|
||||
// the user clicks the `Send` button very quickly twice or
|
||||
@@ -330,7 +329,7 @@ export function finish() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (popover_menus.is_time_selected_for_schedule()) {
|
||||
if (from_do_schedule_message) {
|
||||
schedule_message_to_custom_date();
|
||||
} else {
|
||||
send_message();
|
||||
@@ -789,16 +788,6 @@ export function initialize() {
|
||||
}
|
||||
}
|
||||
|
||||
export function reset_compose_scheduling_state(reset_edit_state = true) {
|
||||
$("#compose-textarea").prop("disabled", false);
|
||||
$("#compose-schedule-confirm-button").hide();
|
||||
popover_menus.reset_selected_schedule_time();
|
||||
$("#compose-send-button").show();
|
||||
if (reset_edit_state) {
|
||||
$("#compose-textarea").removeAttr("data-scheduled-message-id");
|
||||
}
|
||||
}
|
||||
|
||||
function schedule_message_to_custom_date() {
|
||||
const compose_message_object = create_message_object();
|
||||
|
||||
@@ -823,12 +812,5 @@ function schedule_message_to_custom_date() {
|
||||
scheduled_delivery_timestamp,
|
||||
};
|
||||
|
||||
// If this is an edit request `scheduled_message_id` will be defined.
|
||||
if ($("#compose-textarea").attr("data-scheduled-message-id")) {
|
||||
scheduled_message_data.scheduled_message_id = $("#compose-textarea").attr(
|
||||
"data-scheduled-message-id",
|
||||
);
|
||||
}
|
||||
|
||||
scheduled_messages.send_request_to_schedule_message(scheduled_message_data, deliver_at);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user