Don't render inside a cloaked post

This commit is contained in:
Neil Lalonde 2019-05-10 14:22:18 -04:00
parent 2ca0adca05
commit d3a5927ede
1 changed files with 14 additions and 10 deletions

View File

@ -7,22 +7,26 @@ export default {
withPluginApi("0.1", api => { withPluginApi("0.1", api => {
api.decorateWidget("post:after", dec => { api.decorateWidget("post:after", dec => {
if (dec.canConnectComponent) { if (dec.canConnectComponent) {
if (!dec.attrs.cloaked) {
return dec.connect({ return dec.connect({
component: "post-bottom-ad", component: "post-bottom-ad",
context: "model" context: "model"
}); });
} }
} else {
// Old way for backwards compatibility // Old way for backwards compatibility
return dec.connect({ return dec.connect({
templateName: "connectors/post-bottom/discourse-adplugin", templateName: "connectors/post-bottom/discourse-adplugin",
context: "model" context: "model"
}); });
}
}); });
}); });
const messageBus = container.lookup('message-bus:main'); const messageBus = container.lookup("message-bus:main");
if (!messageBus) { return; } if (!messageBus) {
return;
}
messageBus.subscribe("/site/house-creatives", function(houseAdsSettings) { messageBus.subscribe("/site/house-creatives", function(houseAdsSettings) {
Discourse.Site.currentProp("house_creatives", houseAdsSettings); Discourse.Site.currentProp("house_creatives", houseAdsSettings);