J’ai intégré Discourse sur mon site (Embed Discourse comments on another website via Javascript - #309 by eviltrout). Discourse crée des publications contenant un aperçu de mon site. Comment puis-je recréer ou recharger une telle publication intégrée, car j’ai modifié les paramètres du crawler et je souhaite recharger l’aperçu de la page où Discourse est intégré ?
La récuisson (rebaking) aiderait-elle ? Existe-t-il une commande dans la console ?
J’ai découvert que
TopicEmbed.find_remote(url)
semble utile pour afficher ce qui serait récupéré.
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?