From db4f5f990d98def7ce7c56cac0aeba18ceb20871 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Mon, 3 Aug 2020 21:44:10 -0400 Subject: [PATCH] Revert "FIX: removes part of the 2.4 legacy code forgotten (#87)" This reverts commit c27d5f8e859cb80fda997db3ce2be2f0d0ce345f. --- .../discourse/components/ad-component.js.es6 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/assets/javascripts/discourse/components/ad-component.js.es6 b/assets/javascripts/discourse/components/ad-component.js.es6 index 90775ce..40b9be2 100644 --- a/assets/javascripts/discourse/components/ad-component.js.es6 +++ b/assets/javascripts/discourse/components/ad-component.js.es6 @@ -51,10 +51,19 @@ export default Ember.Component.extend({ return true; } - let noAdsGroups = this.siteSettings.no_ads_for_groups - .split("|") - .filter(Boolean); - let currentGroups = groups.map(g => g.id.toString()); + let noAdsGroups = this.siteSettings.no_ads_for_groups.split("|"); + + // TODO: Remove when 2.4 becomes the new stable. This is for backwards compatibility. + const groupListUseIDs = this.site.group_list_use_ids; + + let currentGroups = groups; + if (groupListUseIDs) { + currentGroups = currentGroups.map(g => g.id.toString()); + } else { + currentGroups = currentGroups.map(g => g.name.toLowerCase()); + noAdsGroups = noAdsGroups.map(g => g.toLowerCase()); + } + return !currentGroups.any(g => noAdsGroups.includes(g)); },