Skip to content
Permalink
Browse files

FEATURE: add option to disable ads in restricted categories

Use the new setting "no ads for restricted categories".
  • Loading branch information...
nlalonde committed Jul 22, 2019
1 parent 2ceb99e commit 2ad24e4a6095870aaebdc07695a68a56e2d6fc03
@@ -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)
);
},

@@ -1,6 +1,7 @@
en:
site_settings:
no_ads_for_personal_messages: "Don't show ads when viewing personal messages"
no_ads_for_restricted_categories: "Don't show ads in categories that aren't visible to everyone."
no_ads_for_groups: "Don't show ads to users in these groups."
no_ads_for_categories: "Don't show ads on topic list and topic pages belonging to these categories."
no_ads_for_tags: "Don't show ads on topic list and topic pages belonging to these tags."
@@ -2,6 +2,9 @@ ad_plugin:
no_ads_for_personal_messages:
client: true
default: true
no_ads_for_restricted_categories:
client: true
default: false
no_ads_for_groups:
client: true
default: ""

2 comments on commit 2ad24e4

@discoursereviewbot

This comment has been minimized.

Copy link

replied Sep 11, 2019

Régis Hanol posted:

I think that's worthy of a test? Just to ensure we don't break that behavior in the future.

@discoursereviewbot

This comment has been minimized.

Copy link

replied Sep 11, 2019

Please sign in to comment.
You can’t perform that action at this time.