Skip to content

Commit

Permalink
Fix issues with show any language option not working well
Browse files Browse the repository at this point in the history
  • Loading branch information
dsevillamartin committed Apr 10, 2022
1 parent ee513e7 commit f1d26b5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions js/src/forum/addLanguageToDiscussionList.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import app from 'flarum/forum/app';
import { extend } from 'flarum/common/extend';
import IndexPage from 'flarum/forum/components/IndexPage';
import DiscussionHero from 'flarum/forum/components/DiscussionHero';
Expand Down Expand Up @@ -50,17 +51,20 @@ export default () => {

const paramLang = app.search.params().language;
const locale = app.search.params().language ?? app.translator.formatter.locale;
const showAnyOpt = app.forum.attribute('fof-discussion-language.showAnyLangOpt');

if (params.filter.q) {
if (app.forum.attribute('fof-discussion-language.showAnyLangOpt')) {
if (showAnyOpt) {
if (paramLang) {
params.filter.q += ' language:' + paramLang;
}
} else {
params.filter.q += ' language:' + locale;
}
} else {
params.filter.language = locale;
if (!showAnyOpt || paramLang) {
params.filter.language = locale;
}
}
});

Expand Down

0 comments on commit f1d26b5

Please sign in to comment.