fix: is_hidden boolean coercion and forum settings access
This commit is contained in:
parent
2fc66b9bf7
commit
4709b9d1db
|
|
@ -34,5 +34,6 @@ return [
|
|||
(new Flarum\Settings())
|
||||
->default('blomstra-search.search-discussion-subjects', true)
|
||||
->default('blomstra-search.search-post-bodies', true)
|
||||
->default('blomstra-search.min-search-length', Commands\BuildCommand::DEFAULT_MIN_SEARCH_LENGTH),
|
||||
->default('blomstra-search.min-search-length', Commands\BuildCommand::DEFAULT_MIN_SEARCH_LENGTH)
|
||||
->serializeToForum('blomstraSearchMinLength', 'blomstra-search.min-search-length', 'intval'),
|
||||
];
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -9,7 +9,7 @@ import DiscussionsSearchSource from './SearchSources/DiscussionsSearchSource';
|
|||
import extendDiscussionState from './PaginatedListStates/extendDiscussionState';
|
||||
|
||||
app.initializers.add('blomstra-search', () => {
|
||||
const minLength = parseInt(app.data.settings['blomstra-search.min-search-length'] || String(Search.MIN_SEARCH_LEN), 10);
|
||||
const minLength = (app.forum.attribute('blomstraSearchMinLength') as number) || Search.MIN_SEARCH_LEN;
|
||||
if (minLength !== Search.MIN_SEARCH_LEN) {
|
||||
// Flarum provides no extension point for MIN_SEARCH_LEN, so we overwrite the
|
||||
// static property directly. TypeScript `readonly` is compile-time only — at
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ class SearchController extends ListDiscussionsController
|
|||
|
||||
// Guests and non-moderators may not see hidden posts; exclude them from child matching.
|
||||
if ($actor->isGuest() || !$actor->hasPermission('post.hide')) {
|
||||
$postQuery->add(TermQuery::create('is_hidden', false), 'filter');
|
||||
$postQuery->add(TermQuery::create('is_hidden', 'false'), 'filter');
|
||||
}
|
||||
|
||||
$textQuery->add(
|
||||
|
|
|
|||
Loading…
Reference in New Issue