mirror of
https://github.com/discourse/discourse-adplugin.git
synced 2025-07-05 12:52:29 +00:00
FEATURE: option to disable ads on personal messages
Use the new setting "no ads for personal messages".
This commit is contained in:
parent
2ba276b0fb
commit
ad939a851a
@ -28,6 +28,11 @@ export default Ember.Component.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@computed("router.currentRoute.parent.attributes.archetype")
|
||||||
|
isPersonalMessage(topicType) {
|
||||||
|
return topicType === "private_message";
|
||||||
|
},
|
||||||
|
|
||||||
@computed("currentUser.groups")
|
@computed("currentUser.groups")
|
||||||
showToGroups(groups) {
|
showToGroups(groups) {
|
||||||
const currentUser = Discourse.User.current();
|
const currentUser = Discourse.User.current();
|
||||||
@ -49,8 +54,18 @@ export default Ember.Component.extend({
|
|||||||
return !groupNames.any(g => noAdsGroupNames.includes(g));
|
return !groupNames.any(g => noAdsGroupNames.includes(g));
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("currentCategoryId", "topicTagsDisableAds", "topicListTag")
|
@computed(
|
||||||
showOnCurrentPage(categoryId, topicTagsDisableAds, topicListTag) {
|
"currentCategoryId",
|
||||||
|
"topicTagsDisableAds",
|
||||||
|
"topicListTag",
|
||||||
|
"isPersonalMessage"
|
||||||
|
)
|
||||||
|
showOnCurrentPage(
|
||||||
|
categoryId,
|
||||||
|
topicTagsDisableAds,
|
||||||
|
topicListTag,
|
||||||
|
isPersonalMessage
|
||||||
|
) {
|
||||||
return (
|
return (
|
||||||
!topicTagsDisableAds &&
|
!topicTagsDisableAds &&
|
||||||
(!categoryId ||
|
(!categoryId ||
|
||||||
@ -60,7 +75,8 @@ export default Ember.Component.extend({
|
|||||||
.includes(categoryId.toString())) &&
|
.includes(categoryId.toString())) &&
|
||||||
(!topicListTag ||
|
(!topicListTag ||
|
||||||
!this.siteSettings.no_ads_for_tags ||
|
!this.siteSettings.no_ads_for_tags ||
|
||||||
!this.siteSettings.no_ads_for_tags.split("|").includes(topicListTag))
|
!this.siteSettings.no_ads_for_tags.split("|").includes(topicListTag)) &&
|
||||||
|
(!isPersonalMessage || !this.siteSettings.no_ads_for_personal_messages)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
en:
|
en:
|
||||||
site_settings:
|
site_settings:
|
||||||
|
no_ads_for_personal_messages: "Don't show ads when viewing personal messages"
|
||||||
no_ads_for_groups: "Don't show ads to users in these groups."
|
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_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."
|
no_ads_for_tags: "Don't show ads on topic list and topic pages belonging to these tags."
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
ad_plugin:
|
ad_plugin:
|
||||||
|
no_ads_for_personal_messages:
|
||||||
|
client: true
|
||||||
|
default: true
|
||||||
no_ads_for_groups:
|
no_ads_for_groups:
|
||||||
client: true
|
client: true
|
||||||
default: ""
|
default: ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user