mirror of
https://github.com/discourse/discourse-adplugin.git
synced 2025-03-09 13:19:11 +00:00
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.
30 lines
714 B
Ruby
30 lines
714 B
Ruby
# frozen_string_literal: true
|
|
|
|
module ::AdPlugin
|
|
module GuardianExtensions
|
|
def show_dfp_ads?
|
|
!self.user.in_any_groups?(SiteSetting.dfp_exclude_groups_map)
|
|
end
|
|
|
|
def show_adsense_ads?
|
|
!self.user.in_any_groups?(SiteSetting.adsense_exclude_groups_map)
|
|
end
|
|
|
|
def show_carbon_ads?
|
|
!self.user.in_any_groups?(SiteSetting.carbonads_exclude_groups_map)
|
|
end
|
|
|
|
def show_amazon_ads?
|
|
!self.user.in_any_groups?(SiteSetting.amazon_exclude_groups_map)
|
|
end
|
|
|
|
def show_adbutler_ads?
|
|
!self.user.in_any_groups?(SiteSetting.adbutler_exclude_groups_map)
|
|
end
|
|
|
|
def show_to_groups?
|
|
!self.user.in_any_groups?(SiteSetting.no_ads_for_groups_map)
|
|
end
|
|
end
|
|
end
|