Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: setting for category behaviour to default to discovery list options #11

Merged
merged 1 commit into from Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion javascripts/discourse/services/topic-list-previews.js
Expand Up @@ -66,6 +66,16 @@ export default Service.extend({
itemShortRouteName = item.substring(0,item.indexOf("-mobile"))
}

if (settings.topic_list_set_category_defaults) {
if (currentTopicListRoute.indexOf("Category") > -1) {
currentTopicListRoute = item.substring(0,item.indexOf("Category"))
} else {
if (currentTopicListRoute == 'discovery.category') {
currentTopicListRoute = 'discovery.latest'
}
}
}

if (currentTopicListRoute.indexOf(itemShortRouteName) > -1 && ((onMobile && mobileSetting) || (!onMobile && !mobileSetting))) {
return true;
}
Expand Down Expand Up @@ -154,4 +164,4 @@ export default Service.extend({
displayActions(enabledForRoute, displayMode) {
return enabledForRoute && displayMode.includes("actions");
},
});
});
10 changes: 5 additions & 5 deletions settings.yml
Expand Up @@ -66,6 +66,11 @@ topic_list_actions_tags:
default: ""
description:
en: "The tags that will include actions."
topic_list_set_category_defaults:
default: false
type: bool
description:
en: "Set site topic list display settings as defaults for category topic lists."
topic_list_show_like_on_current_users_posts:
type: bool
default: true
Expand Down Expand Up @@ -99,11 +104,6 @@ topic_list_portfolio_filter_parameter:
type: string
description:
en: "Enter the tag or category slug (depending of value of filter type setting)"
topic_list_set_category_defaults:
default: false
type: bool
description:
en: "Set site topic list display settings as defaults for category topic lists."
topic_list_default_thumbnail:
default: ''
type: string
Expand Down