Skip to content

Commit

Permalink
import type PaginatedListParams
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Nov 1, 2024
1 parent 1527ed0 commit 440b89c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions js/src/forum/extenders/extendDiscussionListState.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import app from 'flarum/forum/app';
import { extend } from 'flarum/common/extend';
import DiscussionListState from 'flarum/forum/states/DiscussionListState';
import type { PaginatedListParams } from 'flarum/common/states/PaginatedListState';

export default function extendDiscussionListState() {
extend(DiscussionListState.prototype, 'requestParams', function (params) {
extend(DiscussionListState.prototype, 'requestParams', function (params: PaginatedListParams) {
if (app.discussions.bestAnswer) {
const negate = app.discussions.bestAnswer === '2';
const prepend = negate ? '-' : '';
Expand All @@ -12,7 +13,7 @@ export default function extendDiscussionListState() {
params.filter = {};
}

(params.filter as Record<string, string>)[`${prepend}solved-discussions`] = 'true';
(params.filter)[`${prepend}solved-discussions`] = 'true';

if (params.filter.q) {
params.filter.q += ` ${prepend}is:solved`;
Expand Down

0 comments on commit 440b89c

Please sign in to comment.