FIX: Ensure we won't render the connector if there are no ads (#148)

This commit is contained in:
Roman Rizzi 2022-07-14 15:58:29 -03:00 committed by GitHub
parent d9b739f803
commit 4940d0ea19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -99,8 +99,8 @@ export function slotContenders(
site, site,
siteSettings, siteSettings,
placement, placement,
postNumber, indexNumber,
indexNumber postNumber
) { ) {
let types = []; let types = [];
const houseAds = site.get("house_creatives"), const houseAds = site.get("house_creatives"),
@ -186,8 +186,8 @@ export default AdComponent.extend({
this.site, this.site,
this.siteSettings, this.siteSettings,
placement, placement,
postNumber, indexNumber,
indexNumber postNumber
); );
}, },

View File

@ -3,12 +3,13 @@ import { slotContenders } from "discourse/plugins/discourse-adplugin/discourse/c
export default { export default {
shouldRender(args, component) { shouldRender(args, component) {
return ( return (
args.index &&
slotContenders( slotContenders(
component.site, component.site,
component.siteSettings, component.siteSettings,
"topic-list-between", "topic-list-between",
args.index args.index
).length === 0 ).length > 0
); );
}, },
}; };