FIX: Only show search if there are more total posts than the chunk size
This commit is contained in:
parent
3d32460e1c
commit
dcdd5baf54
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue