From bb579f8823b683d53820f89dd988424f6fe6f198 Mon Sep 17 00:00:00 2001 From: Rohitt Vashishtha Date: Sat, 11 Jan 2020 21:42:29 +0530 Subject: [PATCH] unreads: Remove is_reading_mode(). This was a part of an experiment we ran on chat.zulip.org in Jul 2018 and surrounding code that used it never got merged to master. See: https://chat.zulip.org/#narrow/stream/2-general/topic/un-narrow.20view/near/609506 and https://github.com/zulip/zulip/commit/c407ba517582a1af0bcd5fe080d870897c948511. --- frontend_tests/node_tests/narrow_state.js | 6 ------ static/js/filter.js | 19 ------------------- static/js/narrow_state.js | 8 -------- 3 files changed, 33 deletions(-) diff --git a/frontend_tests/node_tests/narrow_state.js b/frontend_tests/node_tests/narrow_state.js index 702556b3df..3754ec3ac2 100644 --- a/frontend_tests/node_tests/narrow_state.js +++ b/frontend_tests/node_tests/narrow_state.js @@ -30,7 +30,6 @@ run_test('stream', () => { ['search', 'yo'], ]); assert(narrow_state.active()); - assert(!narrow_state.is_reading_mode()); assert.equal(narrow_state.stream(), 'Test'); assert.equal(narrow_state.stream_id(), test_stream.stream_id); @@ -59,7 +58,6 @@ run_test('narrowed', () => { assert(!narrow_state.narrowed_to_topic()); assert(!narrow_state.narrowed_by_stream_reply()); assert.equal(narrow_state.stream_id(), undefined); - assert(narrow_state.is_reading_mode()); set_filter([['stream', 'Foo']]); assert(!narrow_state.narrowed_to_pms()); @@ -69,7 +67,6 @@ run_test('narrowed', () => { assert(!narrow_state.narrowed_to_search()); assert(!narrow_state.narrowed_to_topic()); assert(narrow_state.narrowed_by_stream_reply()); - assert(narrow_state.is_reading_mode()); set_filter([['pm-with', 'steve@zulip.com']]); assert(narrow_state.narrowed_to_pms()); @@ -79,7 +76,6 @@ run_test('narrowed', () => { assert(!narrow_state.narrowed_to_search()); assert(!narrow_state.narrowed_to_topic()); assert(!narrow_state.narrowed_by_stream_reply()); - assert(narrow_state.is_reading_mode()); set_filter([['stream', 'Foo'], ['topic', 'bar']]); assert(!narrow_state.narrowed_to_pms()); @@ -89,7 +85,6 @@ run_test('narrowed', () => { assert(!narrow_state.narrowed_to_search()); assert(narrow_state.narrowed_to_topic()); assert(!narrow_state.narrowed_by_stream_reply()); - assert(narrow_state.is_reading_mode()); set_filter([['search', 'grail']]); assert(!narrow_state.narrowed_to_pms()); @@ -99,7 +94,6 @@ run_test('narrowed', () => { assert(narrow_state.narrowed_to_search()); assert(!narrow_state.narrowed_to_topic()); assert(!narrow_state.narrowed_by_stream_reply()); - assert(!narrow_state.is_reading_mode()); }); run_test('operators', () => { diff --git a/static/js/filter.js b/static/js/filter.js index 43134bd936..4ac779e850 100644 --- a/static/js/filter.js +++ b/static/js/filter.js @@ -489,25 +489,6 @@ Filter.prototype = { return _.isEqual(term_types, wanted_term_types); }, - is_reading_mode: function () { - // We only turn on "reading mode" for filters that - // have contiguous messages for a narrow, as opposed - // to "random access" queries like search: - // or id: that jump you to parts of the message - // view where you might only care about reading the - // current message. - const term_types = this.sorted_term_types(); - const wanted_list = [ - ['stream'], - ['stream', 'topic'], - ['is-private'], - ['pm-with'], - ]; - return _.any(wanted_list, function (wanted_types) { - return _.isEqual(wanted_types, term_types); - }); - }, - can_bucket_by: function () { // TODO: in ES6 use spread operator // diff --git a/static/js/narrow_state.js b/static/js/narrow_state.js index e574f0891c..0c60245d01 100644 --- a/static/js/narrow_state.js +++ b/static/js/narrow_state.js @@ -18,14 +18,6 @@ exports.filter = function () { return current_filter; }; -exports.is_reading_mode = function () { - if (current_filter === undefined) { - return true; - } - - return current_filter.is_reading_mode(); -}; - exports.operators = function () { if (current_filter === undefined) { return new Filter(page_params.narrow).operators();