When a post is created through the API with an embed_url property, the TopidEmbed that’s created on Discourse isn’t being destroyed when the topic is deleted. I don’t know if this is by accident or by design.
The problem I’m having with it is that it makes it hard to setup any integration tests between the wp-discourse plugin and Discourse. Every time the tests are run, the TopicEmbeds that are created by the tests have to be deleted through the rails console.
It also creates a small problem for general use of the plugin. If a post on Discourse that has been created through the wp-discourse plugin is ever deleted, the only way to republish it from WordPress is to go to the rails console and delete the TopicEmbed that is associated with the post.
I’m not fetching them, the embed_url is sent as a property when a post is published on Discourse through the wp-discourse plugin. The post can’t be created if the embed_url already exists because TopicEmbed validates the uniqueness of embed_url.
I think we need to make TopicEmbed trashable as well. I’m not too farmiliar with what TopicEmbed is used for though so maybe someone else from @team can assist.