FEATURE: add option to disable ads in restricted categories

Use the new setting "no ads for restricted categories".
This commit is contained in:
Neil Lalonde
2019-07-22 11:43:39 -04:00
parent 2ceb99e151
commit 2ad24e4a60
3 changed files with 16 additions and 3 deletions
@@ -18,6 +18,11 @@ export default Ember.Component.extend({
"router.currentRoute.parent.attributes.tags_disable_ads"
),
isRestrictedCategory: Ember.computed.or(
"router.currentRoute.attributes.category.read_restricted",
"router.currentRoute.parent.attributes.category.read_restricted"
),
@computed(
"router.currentRoute.attributes.__type",
"router.currentRoute.attributes.id"
@@ -66,13 +71,15 @@ export default Ember.Component.extend({
"currentCategoryId",
"topicTagsDisableAds",
"topicListTag",
"isPersonalMessage"
"isPersonalMessage",
"isRestrictedCategory"
)
showOnCurrentPage(
categoryId,
topicTagsDisableAds,
topicListTag,
isPersonalMessage
isPersonalMessage,
isRestrictedCategory
) {
return (
!topicTagsDisableAds &&
@@ -84,7 +91,9 @@ export default Ember.Component.extend({
(!topicListTag ||
!this.siteSettings.no_ads_for_tags ||
!this.siteSettings.no_ads_for_tags.split("|").includes(topicListTag)) &&
(!isPersonalMessage || !this.siteSettings.no_ads_for_personal_messages)
(!isPersonalMessage || !this.siteSettings.no_ads_for_personal_messages) &&
(!isRestrictedCategory ||
!this.siteSettings.no_ads_for_restricted_categories)
);
},