mirror of https://github.com/zulip/zulip.git
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 c407ba5175
.
This commit is contained in:
parent
741da61407
commit
bb579f8823
|
@ -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', () => {
|
||||
|
|
|
@ -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:<keyword>
|
||||
// or id:<number> 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
|
||||
//
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue