Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
node-tests: Update references to "private message" and "PM".
Lauryn Menard73e581283157
diff --git a/web/tests/activity.test.js b/web/tests/activity.test.jsindex b2ce86a74b9..7f2d978d09b 100644--- a/web/tests/activity.test.js+++ b/web/tests/activity.test.js@@ -183,9 +183,10 @@ test("huddle_data.process_loaded_messages", () => {{type: "stream",},+ // direct message to myself{type: "private",- display_recipient: [{id: me.user_id}], // PM to myself+ display_recipient: [{id: me.user_id}],},{type: "private",@@ -246,7 +247,7 @@ function buddy_list_add(user_id, $stub) {$("#user_presences").set_find_results(sel, $stub);}-test("PM_update_dom_counts", () => {+test("direct_message_update_dom_counts", () => {const $count = $.create("alice-unread-count");const pm_key = alice.user_id.toString();const $li = $.create("alice stub");diff --git a/web/tests/buddy_data.test.js b/web/tests/buddy_data.test.jsindex 2061e9c6bb4..f85fb47be68 100644--- a/web/tests/buddy_data.test.js+++ b/web/tests/buddy_data.test.js@@ -240,7 +240,7 @@ test("compose fade interactions (missing topic)", () => {assert.equal(faded(), false);});-test("compose fade interactions (PMs)", () => {+test("compose fade interactions (direct messages)", () => {people.add_active_user(fred);set_presence(fred.user_id, "active");@@ -252,8 +252,8 @@ test("compose fade interactions (PMs)", () => {// Don't fade if we're not in a narrow.assert.equal(faded(), false);- // Fade fred if we are narrowed to a PM narrow that does- // not include him.+ // Fade fred if we are narrowed to a direct message narrow+ // that does not include him.compose_fade_helper.set_focused_recipient({type: "private",to_user_ids: "9999999",diff --git a/web/tests/compose_actions.test.js b/web/tests/compose_actions.test.jsindex 15e1aa8c3f5..1121bda4083 100644--- a/web/tests/compose_actions.test.js+++ b/web/tests/compose_actions.test.js@@ -188,7 +188,7 @@ test("start", ({override, override_rewire, mock_template}) => {assert.equal(compose_state.topic(), "");stream_data.clear_subscriptions();- // Start PM+ // Start direct messagecompose_defaults = {private_message_recipient: "[email protected]",};@@ -251,7 +251,7 @@ test("respond_to_message", ({override, override_rewire, mock_template}) => {mock_template("inline_decorated_stream_name.hbs", false, () => {});mock_stream_header_colorblock();- // Test PM+ // Test direct messageconst person = {user_id: 22,email: "[email protected]",diff --git a/web/tests/compose_ui.test.js b/web/tests/compose_ui.test.jsindex b01886b271a..27779ad886b 100644--- a/web/tests/compose_ui.test.js+++ b/web/tests/compose_ui.test.js@@ -204,7 +204,7 @@ run_test("compute_placeholder_text", () => {$t({defaultMessage: "Message #all > Test"}),);- // PM Narrows+ // direct message narrowsopts = {message_type: "private",stream: "",@@ -233,7 +233,7 @@ run_test("compute_placeholder_text", () => {});assert.equal(compose_ui.compute_placeholder_text(opts), $t({defaultMessage: "Message Alice"}));- // Group PM+ // group direct messageopts.private_message_recipient = "[email protected],[email protected]";assert.equal(compose_ui.compute_placeholder_text(opts),diff --git a/web/tests/compose_validate.test.js b/web/tests/compose_validate.test.jsindex 006c167416c..cbc6cba2803 100644--- a/web/tests/compose_validate.test.js+++ b/web/tests/compose_validate.test.js@@ -175,7 +175,7 @@ test_ui("validate", ({override_rewire, mock_template}) => {$("#compose-textarea").val("foobarfoobar");}- // test validating private messages+ // test validating direct messagescompose_state.set_message_type("private");initialize_pm_pill();diff --git a/web/tests/composebox_typeahead.test.js b/web/tests/composebox_typeahead.test.jsindex 442e3dc2d5e..dfbf32caf34 100644--- a/web/tests/composebox_typeahead.test.js+++ b/web/tests/composebox_typeahead.test.js@@ -72,7 +72,7 @@ run_test("verify wildcard mentions typeahead for stream message", () => {assert.equal(mention_stream.special_item_text, "stream (translated: Notify stream)");});-run_test("verify wildcard mentions typeahead for private message", () => {+run_test("verify wildcard mentions typeahead for direct message", () => {compose_state.set_message_type("private");assert.equal(ct.broadcast_mentions().length, 2);const mention_all = ct.broadcast_mentions()[0];@@ -1720,8 +1720,8 @@ test("message people", ({override, override_rewire}) => {});test("muted users excluded from results", () => {- // This logic is common to PM recipients as well as- // mentions typeaheads, so we need only test once.+ // This logic is common to direct message recipients as+ // well as mentions typeaheads, so we need only test once.let results;const opts = {want_broadcast: true,@@ -1743,11 +1743,13 @@ test("muted users excluded from results", () => {assert.deepEqual(results, [mention_all, call_center]);});-test("PM recipients sorted according to stream / topic being viewed", ({override_rewire}) => {- // This tests that PM recipient results are sorted with subscribers of- // the stream / topic being viewed being given priority. If no stream- // is being viewed, the sort is alphabetical (for testing, since we do not- // simulate PM history)+test("direct message recipients sorted according to stream / topic being viewed", ({+ override_rewire,+}) => {+ // This tests that direct message recipient results are sorted with+ // subscribers of the stream / topic being viewed being given priority.+ // If no stream is being viewed, the sort is alphabetical (for testing,+ // since we do not simulate direct message history)let results;// Simulating just cordelia being subscribed to denmark.diff --git a/web/tests/drafts.test.js b/web/tests/drafts.test.jsindex 2b33a571202..74122f31462 100644--- a/web/tests/drafts.test.js+++ b/web/tests/drafts.test.js@@ -78,7 +78,7 @@ const draft_2 = {private_message_recipient: "[email protected]",reply_to: "[email protected]",type: "private",- content: "Test private message",+ content: "Test direct message",};const short_msg = {stream: "stream",@@ -238,7 +238,7 @@ test("remove_old_drafts", () => {private_message_recipient: "[email protected]",reply_to: "[email protected]",type: "private",- content: "Test private message",+ content: "Test direct message",updatedAt: new Date().setDate(-30),};const draft_model = drafts.draft_model;@@ -507,7 +507,7 @@ test("format_drafts", ({override_rewire, mock_template}) => {private_message_recipient: "[email protected]",reply_to: "[email protected]",type: "private",- content: "Test private message",+ content: "Test direct message",updatedAt: date(-1),};const draft_3 = {@@ -521,14 +521,14 @@ test("format_drafts", ({override_rewire, mock_template}) => {private_message_recipient: "[email protected]",reply_to: "[email protected]",type: "private",- content: "Test private message 2",+ content: "Test direct message 2",updatedAt: date(-5),};const draft_5 = {private_message_recipient: "[email protected]",reply_to: "[email protected]",type: "private",- content: "Test private message 3",+ content: "Test direct message 3",updatedAt: date(-2),};@@ -550,21 +550,21 @@ test("format_drafts", ({override_rewire, mock_template}) => {draft_id: "id2",is_stream: false,recipients: "Aaron",- raw_content: "Test private message",+ raw_content: "Test direct message",time_stamp: "Jan 30",},{draft_id: "id5",is_stream: false,recipients: "Aaron",- raw_content: "Test private message 3",+ raw_content: "Test direct message 3",time_stamp: "Jan 29",},{draft_id: "id4",is_stream: false,recipients: "Aaron",- raw_content: "Test private message 2",+ raw_content: "Test direct message 2",time_stamp: "Jan 26",},{@@ -656,7 +656,7 @@ test("filter_drafts", ({override_rewire, mock_template}) => {private_message_recipient: "[email protected]",reply_to: "[email protected]",type: "private",- content: "Test private message",+ content: "Test direct message",updatedAt: date(-1),};const stream_draft_2 = {@@ -670,14 +670,14 @@ test("filter_drafts", ({override_rewire, mock_template}) => {private_message_recipient: "[email protected]",reply_to: "[email protected]",type: "private",- content: "Test private message 2",+ content: "Test direct message 2",updatedAt: date(-5),};const pm_draft_3 = {private_message_recipient: "[email protected]",reply_to: "[email protected]",type: "private",- content: "Test private message 3",+ content: "Test direct message 3",updatedAt: date(-2),};@@ -686,21 +686,21 @@ test("filter_drafts", ({override_rewire, mock_template}) => {draft_id: "id2",is_stream: false,recipients: "Aaron",- raw_content: "Test private message",+ raw_content: "Test direct message",time_stamp: "Jan 30",},{draft_id: "id5",is_stream: false,recipients: "Aaron",- raw_content: "Test private message 3",+ raw_content: "Test direct message 3",time_stamp: "Jan 29",},{draft_id: "id4",is_stream: false,recipients: "Aaron",- raw_content: "Test private message 2",+ raw_content: "Test direct message 2",time_stamp: "Jan 26",},];diff --git a/web/tests/echo.test.js b/web/tests/echo.test.jsindex a83cd893e7a..0974408999b 100644--- a/web/tests/echo.test.js+++ b/web/tests/echo.test.js@@ -249,7 +249,7 @@ run_test("insert_local_message streams", ({override, override_rewire}) => {assert.ok(insert_message_called);});-run_test("insert_local_message PM", ({override, override_rewire}) => {+run_test("insert_local_message direct message", ({override, override_rewire}) => {const local_id_float = 102.01;page_params.user_id = 123;diff --git a/web/tests/example3.test.js b/web/tests/example3.test.jsindex 50365c1c2ce..8febbef88ad 100644--- a/web/tests/example3.test.js+++ b/web/tests/example3.test.js@@ -7,9 +7,9 @@ const {run_test} = require("./lib/test");const {page_params} = require("./lib/zpage_params");// In the Zulip app you can narrow your message stream by topic, by-// sender, by PM recipient, by search keywords, etc. We will discuss-// narrows more broadly, but first let's test out a core piece of-// code that makes things work.+// sender, by direct message recipient, by search keywords, etc.+// We will discuss narrows more broadly, but first let's test out a+// core piece of code that makes things work.const {Filter} = zrequire("../src/filter");const stream_data = zrequire("stream_data");diff --git a/web/tests/example8.test.js b/web/tests/example8.test.jsindex e8565ef0b96..d8ab51e0601 100644--- a/web/tests/example8.test.js+++ b/web/tests/example8.test.js@@ -73,7 +73,7 @@ run_test("typing_events.render_notifications_for_narrow", ({override, mock_templ// All typists are rendered in `#typing_notifications`.const $typing_notifications = $("#typing_notifications");- // Narrow to a PM group with four users.+ // Narrow to a group direct message with four users.override(page_params, "user_id", anna.user_id);const group = [anna.user_id, vronsky.user_id, levin.user_id, kitty.user_id];const group_emails = `${anna.email},${vronsky.email},${levin.email},${kitty.email}`;diff --git a/web/tests/message_edit.test.js b/web/tests/message_edit.test.jsindex ea94a7aa4f7..e1d34e62a3f 100644--- a/web/tests/message_edit.test.js+++ b/web/tests/message_edit.test.js@@ -235,7 +235,7 @@ run_test("stream_and_topic_exist_in_edit_history", () => {// A non-stream message (object has no stream_id or topic)// with content edit history, should return false.const private_message = {- edit_history: [{prev_content: "content edit to PM"}],+ edit_history: [{prev_content: "content edit to direct message"}],};assert.equal(message_edit.stream_and_topic_exist_in_edit_history(private_message, 1, "topic match"),diff --git a/web/tests/message_list_data.test.js b/web/tests/message_list_data.test.jsindex 91c5055c193..fc89a2fca9e 100644--- a/web/tests/message_list_data.test.js+++ b/web/tests/message_list_data.test.js@@ -133,15 +133,22 @@ run_test("muting", () => {const msgs = [{id: 1, type: "stream", stream_id: 1, topic: "muted"},{id: 2, type: "stream", stream_id: 1, topic: "whatever"},- {id: 3, type: "stream", stream_id: 1, topic: "muted", mentioned: true}, // mentions override muting+ // mentions override muting+ {id: 3, type: "stream", stream_id: 1, topic: "muted", mentioned: true},// 10 = muted user, 9 = non-muted user, 11 = you- {id: 4, type: "private", to_user_ids: "9,10,11", sender_id: 10}, // muted to huddle- {id: 5, type: "private", to_user_ids: "9,10,11", sender_id: 9}, // non-muted to huddle- {id: 6, type: "private", to_user_ids: "11", sender_id: 10}, // muted to 1:1 PM- {id: 7, type: "private", to_user_ids: "11", sender_id: 9}, // non-muted to 1:1 PM- {id: 8, type: "private", to_user_ids: "10", sender_id: 11}, // 1:1 PM to muted- {id: 9, type: "private", to_user_ids: "9", sender_id: 11}, // 1:1 PM to non-muted+ // muted to group direct message+ {id: 4, type: "private", to_user_ids: "9,10,11", sender_id: 10},+ // non-muted to group direct message+ {id: 5, type: "private", to_user_ids: "9,10,11", sender_id: 9},+ // muted to 1:1 direct message+ {id: 6, type: "private", to_user_ids: "11", sender_id: 10},+ // non-muted to 1:1 direct message+ {id: 7, type: "private", to_user_ids: "11", sender_id: 9},+ // 1:1 direct message to muted+ {id: 8, type: "private", to_user_ids: "10", sender_id: 11},+ // 1:1 direct message to non-muted+ {id: 9, type: "private", to_user_ids: "9", sender_id: 11},];user_topics.update_user_topics(1, "muted", user_topics.all_visibility_policies.MUTED);@@ -151,8 +158,8 @@ run_test("muting", () => {// messages if `excludes_muted_topics` is false.assert.deepEqual(mld.messages_filtered_for_topic_mutes(msgs), msgs);- // If we are in a 1:1 PM narrow, `messages_filtered_for_user_mutes` should skip- // filtering messages.+ // If we are in a 1:1 direct message narrow, `messages_filtered_for_user_mutes`+ // should skip filtering messages.assert.deepEqual(mld.messages_filtered_for_user_mutes(msgs), msgs);// Test actual behaviour of `messages_filtered_for_*` methods.@@ -163,7 +170,7 @@ run_test("muting", () => {{id: 2, type: "stream", stream_id: 1, topic: "whatever"},{id: 3, type: "stream", stream_id: 1, topic: "muted", mentioned: true}, // mentions override muting- // `messages_filtered_for_topic_mutes` does not affect private messages+ // `messages_filtered_for_topic_mutes` does not affect direct messages{id: 4, type: "private", to_user_ids: "9,10,11", sender_id: 10},{id: 5, type: "private", to_user_ids: "9,10,11", sender_id: 9},{id: 6, type: "private", to_user_ids: "11", sender_id: 10},@@ -178,11 +185,14 @@ run_test("muting", () => {{id: 1, type: "stream", stream_id: 1, topic: "muted"},{id: 2, type: "stream", stream_id: 1, topic: "whatever"},{id: 3, type: "stream", stream_id: 1, topic: "muted", mentioned: true},-- {id: 4, type: "private", to_user_ids: "9,10,11", sender_id: 10}, // muted to huddle- {id: 5, type: "private", to_user_ids: "9,10,11", sender_id: 9}, // non-muted to huddle- {id: 7, type: "private", to_user_ids: "11", sender_id: 9}, // non-muted to 1:1 PM- {id: 9, type: "private", to_user_ids: "9", sender_id: 11}, // 1:1 PM to non-muted+ // muted to group direct message+ {id: 4, type: "private", to_user_ids: "9,10,11", sender_id: 10},+ // non-muted to group direct message+ {id: 5, type: "private", to_user_ids: "9,10,11", sender_id: 9},+ // non-muted to 1:1 direct message+ {id: 7, type: "private", to_user_ids: "11", sender_id: 9},+ // 1:1 direct message to non-muted+ {id: 9, type: "private", to_user_ids: "9", sender_id: 11},]);// Output filtered based on both topic and user muting.diff --git a/web/tests/pm_conversations.test.js b/web/tests/pm_conversations.test.jsindex 924dcbaf864..e47806e89cc 100644--- a/web/tests/pm_conversations.test.js+++ b/web/tests/pm_conversations.test.js@@ -58,7 +58,8 @@ test("insert_recent_private_message", () => {// Insert new messages (which should rearrange these entries).pmc.recent.insert([1], 1000);pmc.recent.insert([1, 2, 3], 999);- pmc.recent.insert([], 101); // Self-PM+ // direct message to oneself+ pmc.recent.insert([], 101);// Try to backdate user1's latest message.pmc.recent.insert([1], 555);@@ -91,7 +92,7 @@ test("muted_users", () => {muted_users.add_muted_user(2);// We should now get back only those messages which are either-- // 1:1 PMs in which the other user hasn't been muted.+ // 1:1 direct messages in which the other user hasn't been muted.// Huddles where there's at least one non-muted participant.assert.deepEqual(pmc.recent.get(), [{user_ids_string: "3", max_message_id: 99},diff --git a/web/tests/pm_list_data.test.js b/web/tests/pm_list_data.test.jsindex b554b01a6dc..c2a73b2155f 100644--- a/web/tests/pm_list_data.test.js+++ b/web/tests/pm_list_data.test.js@@ -248,7 +248,7 @@ test("get_list_info_unread_messages", ({override}) => {"Bob",]);- // Narrowing to private messages with Alice adds older+ // Narrowing to direct messages with Alice adds older// one-on-one conversation with her to the list and one// unread is removed from more_conversations_unread_count.set_pm_with_filter("[email protected]");@@ -325,7 +325,7 @@ test("get_list_info_no_unread_messages", ({override}) => {"Bob",]);- // Narrowing to private messages with Alice adds older+ // Narrowing to direct messages with Alice adds older// one-on-one conversation with her to the list.set_pm_with_filter("[email protected]");list_info = pm_list_data.get_list_info(false);diff --git a/web/tests/recent_senders.test.js b/web/tests/recent_senders.test.jsindex bfdca9ef400..74fc8675a08 100644--- a/web/tests/recent_senders.test.js+++ b/web/tests/recent_senders.test.js@@ -340,7 +340,7 @@ test("process_pms", () => {participants: [1, 3, 2],non_participants: [4],});- // PM doesn't exist.+ // Direct message doesn't exist.assert.deepEqual(rs.get_pm_recent_senders("1000,2000"), {participants: [],non_participants: [],diff --git a/web/tests/recent_topics.test.js b/web/tests/recent_topics.test.jsindex 86f2cf86f28..fe562173de4 100644--- a/web/tests/recent_topics.test.js+++ b/web/tests/recent_topics.test.js@@ -871,7 +871,7 @@ test("basic assertions", ({mock_template, override_rewire}) => {"4:topic-10,1:topic-7,1:topic-6,1:topic-5,1:topic-4,1:topic-3,1:topic-2,1:topic-1",);- // Process private message+ // Process direct messagert_data.process_message({type: "private",to_user_ids: "6,7,8",diff --git a/web/tests/typeahead_helper.test.js b/web/tests/typeahead_helper.test.jsindex 9bf6e2772f1..6f7fb311225 100644--- a/web/tests/typeahead_helper.test.js+++ b/web/tests/typeahead_helper.test.js@@ -334,7 +334,7 @@ test("sort_recipients", () => {]);- // Typeahead for private message [query, "", ""]+ // Typeahead for direct message [query, "", ""]assert.deepEqual(get_typeahead_result("a", "", ""), [@@ -352,7 +352,7 @@ test("sort_recipients", () => {peer_data.add_subscriber(1, people.get_user_id(subscriber_email_2));peer_data.add_subscriber(1, people.get_user_id(subscriber_email_3));- // For splitting based on whether a PM was sent+ // For splitting based on whether a direct message was sentpm_conversations.set_partner(5);pm_conversations.set_partner(6);pm_conversations.set_partner(2);@@ -524,7 +524,7 @@ test("sort_recipients dup alls", () => {assertSameEmails(recipients, expected);});-test("sort_recipients dup alls private", () => {+test("sort_recipients dup alls direct message", () => {compose_state.set_message_type("private");const all_obj = ct.broadcast_mentions()[0];@@ -597,7 +597,7 @@ test("sort broadcast mentions for stream message type", () => {);});-test("sort broadcast mentions for private message type", () => {+test("sort broadcast mentions for direct message type", () => {compose_state.set_message_type("private");const results = th.sort_people_for_relevance(ct.broadcast_mentions().reverse(), "", "");@@ -630,7 +630,7 @@ test("test compare directly for stream message type", () => {assert.equal(th.compare_people_for_relevance(zman, all_obj), 1);});-test("test compare directly for private message", () => {+test("test compare directly for direct message", () => {compose_state.set_message_type("private");const all_obj = ct.broadcast_mentions()[0];diff --git a/web/tests/user_topics.test.js b/web/tests/user_topics.test.jsindex 8f3278a40fb..291cc957842 100644--- a/web/tests/user_topics.test.js+++ b/web/tests/user_topics.test.js@@ -50,7 +50,7 @@ function test(label, f) {}test("edge_cases", () => {- // private messages+ // direct messagesassert.ok(!user_topics.is_topic_muted(undefined, undefined));});