From 2afe6fea3acf21be72804ce8a048feb263fea48d Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 2 May 2023 11:48:50 -0700 Subject: [PATCH] send_later: Fix leaking drafts for scheduled messages. Previously, if one had started working on a message from a draft, and then schedules it to be sent later, the draft would not be cleared when the server accepts the request to schedule the message. --- web/src/scheduled_messages.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/src/scheduled_messages.js b/web/src/scheduled_messages.js index fcbd587333..38b49de4ab 100644 --- a/web/src/scheduled_messages.js +++ b/web/src/scheduled_messages.js @@ -7,6 +7,7 @@ import * as compose from "./compose"; import * as compose_actions from "./compose_actions"; import * as compose_banner from "./compose_banner"; import * as compose_ui from "./compose_ui"; +import * as drafts from "./drafts"; import * as narrow from "./narrow"; import * as people from "./people"; import * as popover_menus from "./popover_menus"; @@ -93,6 +94,7 @@ export function open_scheduled_message_in_compose(scheduled_msg) { export function send_request_to_schedule_message(scheduled_message_data, deliver_at) { const success = function (data) { + drafts.draft_model.deleteDraft($("#compose-textarea").data("draft-id")); compose.clear_compose_box(); const new_row = render_success_message_scheduled_banner({ scheduled_message_id: data.scheduled_message_id,