From 3cfc3ca24b234aaa7900ffab9e1e78b48b16a582 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Tue, 2 Apr 2019 17:48:47 +0000 Subject: [PATCH] pm list: Remove "(more conversations)" feature. Now that we have a scroll container for the PM list, it doesn't make much sense to limit the number to five. We may resurrect this feature if "more conversations" actually fetches more conversations, but it doesn't currently. We also may soon make it easy to limit PMs to just unread messages, which will make the max-5 feature perhaps less necessary, and we don't want to make the UI overly complicated. --- frontend_tests/node_tests/pm_list.js | 11 ---- frontend_tests/node_tests/templates.js | 1 - static/js/pm_list.js | 54 ++----------------- static/styles/left-sidebar.scss | 20 +------ .../sidebar_private_message_list.handlebars | 9 +--- 5 files changed, 8 insertions(+), 87 deletions(-) diff --git a/frontend_tests/node_tests/pm_list.js b/frontend_tests/node_tests/pm_list.js index ec7b8ade30..dc60a16a98 100644 --- a/frontend_tests/node_tests/pm_list.js +++ b/frontend_tests/node_tests/pm_list.js @@ -91,15 +91,12 @@ run_test('build_private_messages_list', () => { user_ids_string: '101,102', unread: 1, is_zero: false, - zoom_out_hide: false, url: '#narrow/pm-with/101,102-group', user_circle_class: 'user_circle_fraction', fraction_present: false, is_group: true, }, ], - zoom_class: 'zoomed-out', - want_show_more_messages_links: false, }; assert.deepEqual(template_data, expected_data); @@ -111,17 +108,9 @@ run_test('build_private_messages_list', () => { pm_list._build_private_messages_list(active_conversation_2, max_conversations); expected_data.messages[0].unread = 0; expected_data.messages[0].is_zero = true; - expected_data.messages[0].zoom_out_hide = true; - expected_data.want_show_more_messages_links = true; assert.deepEqual(template_data, expected_data); - $('.top_left_private_messages').on = function (action, selector, f) { - var e = { preventDefault: function () {}, stopPropagation: function () {}}; - f(e); - }; pm_list.initialize(); - expected_data.zoom_class = "zoomed-in"; - expected_data.want_show_more_messages_links = false; pm_list._build_private_messages_list(active_conversation_2, max_conversations); assert.deepEqual(template_data, expected_data); }); diff --git a/frontend_tests/node_tests/templates.js b/frontend_tests/node_tests/templates.js index 023e28c35b..9afbd87391 100644 --- a/frontend_tests/node_tests/templates.js +++ b/frontend_tests/node_tests/templates.js @@ -1183,7 +1183,6 @@ run_test('sidebar_private_message_list', () => { var conversations = $(html).find('a').text().trim().split('\n'); assert.equal(conversations[0], 'alice,bob'); - assert.equal(conversations[1].trim(), '(translated: more conversations)'); }); run_test('stream_member_list_entry', () => { diff --git a/static/js/pm_list.js b/static/js/pm_list.js index a8cf19a55d..19244cdd90 100644 --- a/static/js/pm_list.js +++ b/static/js/pm_list.js @@ -4,11 +4,6 @@ var exports = {}; var private_messages_open = false; -// You can click on "more conversations" to zoom in. There's no -// way to zoom back out other than re-narrowing out and in of the -// PM list. -var zoomed_in = false; - // This module manages the "Private Messages" section in the upper // left corner of the app. This was split out from stream_list.js. @@ -66,46 +61,28 @@ function remove_expanded_private_messages() { resize.resize_stream_filters_container(); } -function zoom_in() { - zoomed_in = true; - var list_widget = $("ul.expanded_private_messages").expectOne(); - list_widget.removeClass("zoomed-out").addClass("zoomed-in"); - ui.update_scrollbar($("#private-container")); -} - exports.close = function () { private_messages_open = false; - zoomed_in = false; remove_expanded_private_messages(); }; -exports._build_private_messages_list = function (active_conversation, max_private_messages) { +exports._build_private_messages_list = function (active_conversation) { var private_messages = pm_conversations.recent.get(); var display_messages = []; - var hiding_messages = false; // SHIM if (active_conversation) { active_conversation = people.emails_strings_to_user_ids_string(active_conversation); } - _.each(private_messages, function (private_message_obj, idx) { + _.each(private_messages, function (private_message_obj) { var user_ids_string = private_message_obj.user_ids_string; var reply_to = people.user_ids_string_to_emails_string(user_ids_string); var recipients_string = people.get_recipients(user_ids_string); var num_unread = unread.num_unread_for_person(user_ids_string); - var always_visible = idx < max_private_messages || num_unread > 0 - || user_ids_string === active_conversation; - - if (!always_visible) { - if (!zoomed_in) { - hiding_messages = true; - } - } - var is_group = user_ids_string.indexOf(',') >= 0; var user_circle_class = buddy_data.get_user_circle_class(user_ids_string); @@ -121,7 +98,6 @@ exports._build_private_messages_list = function (active_conversation, max_privat user_ids_string: user_ids_string, unread: num_unread, is_zero: num_unread === 0, - zoom_out_hide: !always_visible, url: hash_util.pm_with_uri(reply_to), user_circle_class: user_circle_class, fraction_present: fraction_present, @@ -130,18 +106,8 @@ exports._build_private_messages_list = function (active_conversation, max_privat display_messages.push(display_message); }); - var zoom_class; - - if (zoomed_in) { - zoom_class = "zoomed-in"; - } else { - zoom_class = "zoomed-out"; - } - var recipients_dom = templates.render('sidebar_private_message_list', - {messages: display_messages, - zoom_class: zoom_class, - want_show_more_messages_links: hiding_messages}); + {messages: display_messages}); return recipients_dom; }; @@ -150,10 +116,9 @@ exports.rebuild_recent = function (active_conversation) { $("#private-container").remove(); if (private_messages_open) { - var max_private_messages = 5; var private_li = get_filter_li(); var private_messages_dom = exports._build_private_messages_list( - active_conversation, max_private_messages); + active_conversation); private_li.append(private_messages_dom); } @@ -200,15 +165,6 @@ exports.update_private_messages = function () { } }; -exports.set_click_handlers = function () { - $('.top_left_private_messages').on('click', '.show-more-private-messages', function (e) { - popovers.hide_all(); - zoom_in(); - e.preventDefault(); - e.stopPropagation(); - }); -}; - exports.expand = function (op_pm) { private_messages_open = true; if (op_pm.length === 1) { @@ -235,7 +191,7 @@ exports.update_dom_with_unread_counts = function (counts) { exports.initialize = function () { - pm_list.set_click_handlers(); + // will add back soon }; return exports; diff --git a/static/styles/left-sidebar.scss b/static/styles/left-sidebar.scss index bae07df903..0344aaa5b0 100644 --- a/static/styles/left-sidebar.scss +++ b/static/styles/left-sidebar.scss @@ -37,8 +37,7 @@ $topic_indent: $far_left_gutter_size + $left_col_size + 4px; font-size: 14px; } -li.show-more-topics a, -li.show-more-private-messages a { +li.show-more-topics a { font-size: 12px; } @@ -181,10 +180,6 @@ li.top_left_starred_messages { padding-right: 10px; } -li.show-more-private-messages { - padding-left: $far_left_gutter_size + $left_col_size; -} - .top_left_row, .bottom_left_row, .top_left_private_messages { @@ -422,7 +417,6 @@ li.topic-list-item { padding-right: 5px; } -li.show-more-private-messages, li.expanded_private_message { position: relative; padding-top: 1px; @@ -536,18 +530,6 @@ li.show-more-topics a { display: none; } -.zoomed-in .show-more-private-messages { - display: none; -} - -.zoomed-out .zoom-out-hide { - display: none; -} - -.zoom-out .zoom-out-hide { - display: none; -} - .zoom-in .zoom-in-hide { display: none; } diff --git a/static/templates/sidebar_private_message_list.handlebars b/static/templates/sidebar_private_message_list.handlebars index c25575c689..9f97d8612b 100644 --- a/static/templates/sidebar_private_message_list.handlebars +++ b/static/templates/sidebar_private_message_list.handlebars @@ -1,7 +1,7 @@
-