FIX: Only show search if there are more total posts than the chunk size

This commit is contained in:
Robin Ward 2017-07-10 13:46:30 -04:00
parent 3d32460e1c
commit dcdd5baf54
1 changed files with 6 additions and 2 deletions

View File

@ -306,8 +306,12 @@ export default createWidget('header', {
// If we're viewing a topic, only intercept search if there are cloaked posts
if (showSearch && currentPath.match(/^topic\./)) {
showSearch = ($('.topic-post .cooked, .small-action:not(.time-gap)').length <
this.register.lookup('controller:topic').get('model.postStream.stream.length'));
const controller = this.register.lookup('controller:topic');
const total = controller.get('model.postStream.stream.length') || 0;
const chunkSize = controller.get('model.chunk_size') || 0;
showSearch = (total > chunkSize) &&
$('.topic-post .cooked, .small-action:not(.time-gap)').length < total;
}
if (state.searchVisible) {