stream_data: Remove untested useless code.

This code was actually dead, due to the .empty() check above.  Fixing
this lets us restore 100% coverage.
This commit is contained in:
Steve Howell 2019-03-15 15:38:36 +00:00 committed by Tim Abbott
parent ea112828dc
commit ba0418c989
2 changed files with 2 additions and 9 deletions

View File

@ -372,13 +372,6 @@ exports.all_topics_in_cache = function (sub) {
return false; return false;
} }
// This happens before message_list.all is initialized; just
// return false since the cache is empty.
var first_cached_message = message_list.all.first();
if (first_cached_message === undefined) {
return false;
}
if (sub.first_message_id === null) { if (sub.first_message_id === null) {
// If the stream has no message history, we have it all // If the stream has no message history, we have it all
// vacuously. This should be a very rare condition, since // vacuously. This should be a very rare condition, since
@ -390,6 +383,7 @@ exports.all_topics_in_cache = function (sub) {
// message ID in the stream; if it's older, we're good, otherwise, // message ID in the stream; if it's older, we're good, otherwise,
// we might be missing the oldest topics in this stream in our // we might be missing the oldest topics in this stream in our
// cache. // cache.
var first_cached_message = message_list.all.first();
return first_cached_message.id <= sub.first_message_id; return first_cached_message.id <= sub.first_message_id;
}; };

View File

@ -69,8 +69,7 @@ enforce_fully_covered = {
# 'static/js/settings_ui.js', # 'static/js/settings_ui.js',
'static/js/settings_muting.js', 'static/js/settings_muting.js',
'static/js/settings_user_groups.js', 'static/js/settings_user_groups.js',
# Removed temporarily 'static/js/stream_data.js',
# 'static/js/stream_data.js',
'static/js/stream_events.js', 'static/js/stream_events.js',
'static/js/stream_sort.js', 'static/js/stream_sort.js',
'static/js/top_left_corner.js', 'static/js/top_left_corner.js',