Ho incorporato Discourse sul mio sito (Embed Discourse comments on another website via Javascript - #309 by eviltrout). Discourse crea post contenenti un’anteprima del mio sito. Come posso ricreare/richiedere di nuovo un post incorporato simile, dato che ho modificato i parametri del crawler e vorrei aggiornare l’anteprima della pagina in cui Discourse è incorporato?
Potrebbe aiutare il “rebaking”? C’è un comando nella console?
Ho scoperto che
TopicEmbed.find_remote(url)
sembra essere utile per visualizzare cosa verrebbe recuperato.
Looking through the source I found this to be a working solution:
username = SiteSetting.embed_by_username.downcase
user = User.where(username_lower: username.downcase).first
embed_url = "http://www.example.org" # or use the url from topic as shown below
TopicEmbed.import_remote(user, embed_url)
taken from TopicRetriever.fetch_http (discourse/lib/topic_retriever.rb at 888e68a1637ca784a7bf51a6bbb524dcf7413b13 · discourse/discourse · GitHub)
where embed_url is the url of the site where discourse is embedded, coming from the topic with the number topic_id this may be
embed_url = TopicEmbed.where(topic: topic_id)[0].embed_url
This seems a bit complicated to just refetch. Is it correct anyway? Is there a simpler possibility?