mirror of
https://github.com/discourse/discourse.git
synced 2025-02-23 03:02:12 +08:00
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 we're viewing a topic, only intercept search if there are cloaked posts
|
||||||
if (showSearch && currentPath.match(/^topic\./)) {
|
if (showSearch && currentPath.match(/^topic\./)) {
|
||||||
showSearch = ($('.topic-post .cooked, .small-action:not(.time-gap)').length <
|
const controller = this.register.lookup('controller:topic');
|
||||||
this.register.lookup('controller:topic').get('model.postStream.stream.length'));
|
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) {
|
if (state.searchVisible) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user