Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

drafts: Delete old drafts on page load, not modal launch.

Tim Abbott8f74261d4830
diff --git a/frontend_tests/node_tests/drafts.js b/frontend_tests/node_tests/drafts.js
index f7e1dddccf6..cea88a72a7e 100644
--- a/frontend_tests/node_tests/drafts.js
+++ b/frontend_tests/node_tests/drafts.js
@@ -201,8 +201,6 @@ test("remove_old_drafts", () => {
});
test("format_drafts", ({override, mock_template}) => {
- override(drafts, "remove_old_drafts", noop);
-
function feb12() {
return new Date(1549958107000); // 2/12/2019 07:55:07 AM (UTC+0)
}
diff --git a/static/js/drafts.js b/static/js/drafts.js
index 2772b061181..7e77282838e 100644
--- a/static/js/drafts.js
+++ b/static/js/drafts.js
@@ -389,7 +389,6 @@ export function launch() {
});
}
- remove_old_drafts();
const drafts = format_drafts(draft_model.get());
render_widgets(drafts);
@@ -551,6 +550,8 @@ export function set_initial_element(drafts) {
}
export function initialize() {
+ remove_old_drafts();
+
window.addEventListener("beforeunload", () => {
update_draft();
});