FIX: Calculate no ads for groups server side (#200)
If the selected group to not display ads to had its visibility set to not be visible then this setting wouldn't work correctly because that group wouldn't be available client side. The change moves that group check to be server side so that we can correctly see all the groups that should not see ads.
This commit is contained in:
@@ -45,25 +45,13 @@ export default Component.extend({
|
||||
return topicType === "private_message";
|
||||
},
|
||||
|
||||
@discourseComputed("currentUser.groups")
|
||||
showToGroups(groups) {
|
||||
const currentUser = this.currentUser;
|
||||
|
||||
if (
|
||||
!currentUser ||
|
||||
!groups ||
|
||||
!this.siteSettings.no_ads_for_groups ||
|
||||
this.siteSettings.no_ads_for_groups.length === 0
|
||||
) {
|
||||
@discourseComputed
|
||||
showToGroups() {
|
||||
if (!this.currentUser) {
|
||||
return true;
|
||||
}
|
||||
|
||||
let noAdsGroups = this.siteSettings.no_ads_for_groups
|
||||
.split("|")
|
||||
.filter(Boolean);
|
||||
let currentGroups = groups.map((g) => g.id.toString());
|
||||
|
||||
return !currentGroups.any((g) => noAdsGroups.includes(g));
|
||||
return this.currentUser.show_to_groups;
|
||||
},
|
||||
|
||||
@discourseComputed(
|
||||
|
||||
Reference in New Issue
Block a user