Is it possible to replace/change an embedded post's behavior?

Hello,

Last year I hooked up my Ghost blog to my Discourse forum and went about my blogging ways. However, I’ve since decided to kill the blog, but I want to preserve the content on Discourse directly.

I’m editing the original first post in the topic and replacing it with the original markdown from my blog. All is well in the preview, but the end result ends up as a jumble of un-rendered markdown with all newlines removed; a giant block of text. Additionally, the “Show Full Post” and “This is a companion discussion topic…” still persist.

Is it possible to do what I am attempting, or do I need to recreate each topic and juggle replies between the old and new versions, or perhaps something else entirely?

Simply put, I want to replace these with just plain posts, with Discourse not treating them any differently than if I had posted them directly on Discourse to begin with.

Thank you.

Yeah this is tricky, there is metadata that needs to be nuked. You could try taking a FULL BACKUP and then:

./launcher enter app
rails c
Post.where('id in (select post_id from topic_embeds)').update_all(cook_method: 1)
TopicEmbed.destroy_all

:warning: This may work, or it may obliterate data you don’t want obliterated. If you want the “safe” way, you are going to need to recreate topics and move posts.

4 Likes

Thanks @sam, I’ll test this on a copy to be safe!

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.