# AdPlugin not compatible with changes to model?

**URL:** https://meta.discourse.org/t/adplugin-not-compatible-with-changes-to-model/295251
**Category:** Bug
**Tags:** advertising
**Created:** [February 13, 2024, 8:10pm UTC](https://meta.discourse.org/t/adplugin-not-compatible-with-changes-to-model/295251 "2024-02-13T20:10:16Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [February 13, 2024, 8:10pm UTC](https://meta.discourse.org/t/adplugin-not-compatible-with-changes-to-model/295251/1 "2024-02-13T20:10:16Z")

</div>

I might be seeing things, but this component is expecting a model with a topic object contained:

> <https://github.com/discourse/discourse-adplugin/blob/751916b8e3e8e7c8d6cab906f22a4b75408f9501/assets/javascripts/discourse/components/post-bottom-ad.hbs#L3>

However, when I log this model out, there is no longer a topic attribute?:

 ![image](https://global.discourse-cdn.com/meta/original/4X/e/7/0/e70d9b96d4096858acfb7e8ce42ac0b387e3925a.png)

Is there a reason the topic attribute was removed? I was actually using it too for an extension to the adplugin ☹

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [February 14, 2024, 11:45am UTC](https://meta.discourse.org/t/adplugin-not-compatible-with-changes-to-model/295251/3 "2024-02-14T11:45:43Z")

</div>

Hi Robert - I don’t think this was intentional. Were you able to find out what `@model` is referring to? Would be good to work out whether it was a core or plugin change.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [February 14, 2024, 11:56am UTC](https://meta.discourse.org/t/adplugin-not-compatible-with-changes-to-model/295251/4 "2024-02-14T11:56:40Z")

</div>

Is it not taking the Post model passed down by the `post-bottom` connector?

```plaintext
{{post-bottom-ad model=this}}

```

That said, I performed a search for `post-bottom` on the discourse repo and it comes up blank … I’ll dig a bit more

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [February 14, 2024, 12:44pm UTC](https://meta.discourse.org/t/adplugin-not-compatible-with-changes-to-model/295251/5 "2024-02-14T12:44:36Z")

</div>

This seems very old code:

> <https://github.com/discourse/discourse/blob/c03d22f633b298d08666235a45e4858f14ae3bd2/app/assets/javascripts/discourse/app/widgets/post-stream.js#L271>

Which contains the topic object, so things change _below_ this 😅

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [February 14, 2024, 1:43pm UTC](https://meta.discourse.org/t/adplugin-not-compatible-with-changes-to-model/295251/6 "2024-02-14T13:43:08Z")

</div>

Ok I see what happened here - thanks for the heads-up @merefield

> <https://github.com/discourse/discourse-adplugin/pull/199>
>
> Changes in 0948d6b19e34320f95226cc43fbce976b71ceb31 caused the post-bottom-ad co…mponent to start receiving the widget-ised 'transformedPost' instead of the original \`post\` model. In most cases this difference didn't matter, but it did cause noticable issues with \`@model.category\` and \`@model.topic\`.
> 
> This commit also deletes the unused \`post-bottom/discourse-adplugin.hbs\` connector. In the past, the adplugin itself was defining the post-bottom outlet. But now, we use RenderGlimmer to load the \`post-bottom-ad\` directly.

Two things:

1. During some refactoring a few months ago, we inadvertantly started passing the ‘transformedPost’ instead of ‘post’ into post-bottom-ad

2. During the same refactoring, we left an old `post-bottom/discourse-adplugin.hbs` file lying around. It didn’t actually do anything, but it made this issue waaay more tricky to figure out 😅

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [February 14, 2024, 2:22pm UTC](https://meta.discourse.org/t/adplugin-not-compatible-with-changes-to-model/295251/7 "2024-02-14T14:22:09Z")

</div>

> [@david](#):
>
> tricky to figure out

Is the perfect description 🙂

The post stream UI architecture is quite a beast!

Thanks very much for looking into this!!

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [February 19, 2024, 8:00am UTC](https://meta.discourse.org/t/adplugin-not-compatible-with-changes-to-model/295251/8 "2024-02-19T08:00:35Z")

</div>

This topic was automatically closed after 4 days. New replies are no longer allowed.
