mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
Remove dead code related to unread_in_current_view.
This commit is contained in:
@@ -48,7 +48,6 @@ var zero_counts = {
|
|||||||
stream_count: new Dict(),
|
stream_count: new Dict(),
|
||||||
topic_count: new Dict(),
|
topic_count: new Dict(),
|
||||||
pm_count: new Dict(),
|
pm_count: new Dict(),
|
||||||
unread_in_current_view: 0,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
(function test_empty_counts_while_narrowed() {
|
(function test_empty_counts_while_narrowed() {
|
||||||
@@ -419,31 +418,6 @@ stream_data.get_stream_id = function () {
|
|||||||
assert.deepEqual(counts, zero_counts);
|
assert.deepEqual(counts, zero_counts);
|
||||||
}());
|
}());
|
||||||
|
|
||||||
(function test_num_unread_current_messages() {
|
|
||||||
var count = unread.num_unread_current_messages();
|
|
||||||
assert.equal(count, 0);
|
|
||||||
|
|
||||||
var message = {
|
|
||||||
id: 15,
|
|
||||||
};
|
|
||||||
current_msg_list.all_messages = function () {
|
|
||||||
return [message];
|
|
||||||
};
|
|
||||||
|
|
||||||
// It's a little suspicious that num_unread_current_messages()
|
|
||||||
// is using the pointer as a hint for filtering out unread
|
|
||||||
// messages, but right now, it's impossible for unread messages
|
|
||||||
// to be above the pointer in a narrowed view, so unread.js uses
|
|
||||||
// this for optimization purposes.
|
|
||||||
current_msg_list.selected_id = function () {
|
|
||||||
return 11; // less than our message's id
|
|
||||||
};
|
|
||||||
|
|
||||||
count = unread.num_unread_current_messages();
|
|
||||||
assert.equal(count, 1);
|
|
||||||
}());
|
|
||||||
|
|
||||||
|
|
||||||
(function test_message_unread() {
|
(function test_message_unread() {
|
||||||
// Test some code that might be overly defensive, for line coverage sake.
|
// Test some code that might be overly defensive, for line coverage sake.
|
||||||
assert(!unread.message_unread(undefined));
|
assert(!unread.message_unread(undefined));
|
||||||
|
|||||||
@@ -266,18 +266,6 @@ exports.declare_bankruptcy = function () {
|
|||||||
exports.unread_mentions_counter.clear();
|
exports.unread_mentions_counter.clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.num_unread_current_messages = function () {
|
|
||||||
var num_unread = 0;
|
|
||||||
|
|
||||||
_.each(current_msg_list.all_messages(), function (msg) {
|
|
||||||
if ((msg.id > current_msg_list.selected_id()) && exports.message_unread(msg)) {
|
|
||||||
num_unread += 1;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return num_unread;
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.get_counts = function () {
|
exports.get_counts = function () {
|
||||||
var res = {};
|
var res = {};
|
||||||
|
|
||||||
@@ -298,12 +286,6 @@ exports.get_counts = function () {
|
|||||||
res.private_message_count = pm_res.total_count;
|
res.private_message_count = pm_res.total_count;
|
||||||
res.home_unread_messages += pm_res.total_count;
|
res.home_unread_messages += pm_res.total_count;
|
||||||
|
|
||||||
if (narrow_state.active()) {
|
|
||||||
res.unread_in_current_view = exports.num_unread_current_messages();
|
|
||||||
} else {
|
|
||||||
res.unread_in_current_view = res.home_unread_messages;
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user