Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
drafts: Remove support for legacy drafts with "subject".
Zixuan James Li1e64aa9b79aa
diff --git a/frontend_tests/node_tests/drafts.js b/frontend_tests/node_tests/drafts.jsindex cecbfa8ebb0..775a098aed3 100644--- a/frontend_tests/node_tests/drafts.js+++ b/frontend_tests/node_tests/drafts.js@@ -67,20 +67,6 @@ const {localstorage} = zrequire("localstorage");const drafts = zrequire("drafts");const timerender = zrequire("timerender");-const legacy_draft = {- stream: "stream",- subject: "lunch",- type: "stream",- content: "whatever",-};--const compose_args_for_legacy_draft = {- stream: "stream",- topic: "lunch",- type: "stream",- content: "whatever",-};-const draft_1 = {stream: "stream",stream_id: 30,@@ -96,7 +82,7 @@ const draft_2 = {};const short_msg = {stream: "stream",- subject: "topic",+ topic: "topic",type: "stream",content: "a",};@@ -109,10 +95,6 @@ function test(label, f) {});}-test("legacy", () => {- assert.deepEqual(drafts.restore_message(legacy_draft), compose_args_for_legacy_draft);-});-test("draft_model add", ({override}) => {const draft_model = drafts.draft_model;const ls = localstorage();@@ -223,7 +205,7 @@ test("initialize", ({override_rewire}) => {test("remove_old_drafts", () => {const draft_3 = {stream: "stream",- subject: "topic",+ topic: "topic",type: "stream",content: "Test stream message",updatedAt: Date.now(),@@ -349,7 +331,7 @@ test("format_drafts", ({override_rewire, mock_template}) => {};const draft_3 = {stream: "stream 2",- subject: "topic",+ topic: "topic",type: "stream",content: "Test stream message 2",updatedAt: date(-10),@@ -490,7 +472,7 @@ test("filter_drafts", ({override_rewire, mock_template}) => {};const stream_draft_2 = {stream: "stream 2",- subject: "topic",+ topic: "topic",type: "stream",content: "Test stream message 2",updatedAt: date(-10),diff --git a/static/js/drafts.js b/static/js/drafts.jsindex c712ef17ef0..ab3875c9187 100644--- a/static/js/drafts.js+++ b/static/js/drafts.js@@ -170,7 +170,7 @@ export function restore_message(draft) {compose_args = {type: "stream",stream: draft.stream,- topic: util.get_draft_topic(draft),+ topic: draft.topic,content: draft.content,};} else {@@ -306,13 +306,9 @@ export function format_draft(draft) {draft_model.editDraft(id, draft);}}- let draft_topic = util.get_draft_topic(draft);+ const draft_topic = draft.topic || compose.empty_topic_placeholder();const draft_stream_color = stream_data.get_color(stream_name);- if (draft_topic === "") {- draft_topic = compose.empty_topic_placeholder();- }-formatted = {draft_id: draft.id,is_stream: true,diff --git a/static/js/util.js b/static/js/util.jsindex 4171ad41d3d..35e6430497b 100644--- a/static/js/util.js+++ b/static/js/util.js@@ -217,11 +217,6 @@ export function get_match_topic(obj) {return obj.match_subject;}-export function get_draft_topic(obj) {- // We will need to support subject for old drafts.- return obj.topic || obj.subject || "";-}-export function get_reload_topic(obj) {// When we first upgrade to releases that have// topic=foo in the code, the user's reload URL