Falco
(Falco)
13.Сентябрь.2022 15:42:28
2
Да, именно так работает ядро Discourse с 2018 года:
master ← xrav3nz:fix-topic-embed-import-should-update-user
merged 07:12AM - 02 May 18 UTC
We ran into a problem where `PollFeed` job didn't update the post author with th… e one found in the RSS feed.
Then I found out `TopicEmbed.import` only updates the post body and neglects new title or author, when a post with the same `embed_url` already exists.
---
Consider the scenario:
1. A blog page with Discourse embedded comment hits `embed_controller#comments`
2. The topic doesn't exist yet, so it tries to fetch the content from RSS feed, but it didn't because feed polling is rate limited
4. It then crawls the webpage and creates a topic with [the default `embed_by_username`](https://github.com/discourse/discourse/blob/ab80986184a498f68d99541c63558ea2089f49d3/lib/topic_retriever.rb#L48)
5. `PollFeed` is schedule to run at a later time, and it fetches the title, content, and author from the RSS feed with [`embed_username_key_from_feed`](https://github.com/discourse/discourse/blob/ab80986184a498f68d99541c63558ea2089f49d3/app/jobs/scheduled/poll_feed.rb#L156).
6. The post should be updated with the title, content and author from the feed.
---
Let me know what you think, cheers! 💪
Переместил это обсуждение в новую тему и добавил метку pr-welcome для настройки на уровне плагина, позволяющей отключить обновление автора. Тому, кто захочет заняться этой задачей, скорее всего, потребуется добавить новый параметр в TopicEmbed.import и затем использовать его в плагине.
4 лайка