mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 08:43:25 +08:00
5830f2c9a1
When `SiteSetting.review_every_post` is true and the category `require_topic_approval` system creates two reviewable items. 1. Firstly, because the category needs approval, the `ReviewableQueuePost` record` is created - at this stage, no topic is created. 2. Admin is approving the review. The topic and first post are created. 3. Because `review_every_post` is true `queue_for_review_if_possible` callback is evaluated and `ReviewablePost` is created. 4. Then `ReviewableQueuePost` is linked to the newly generated topic and post. At the beginning, we were thinking about hooking to those guards: ``` def self.queue_for_review_if_possible(post, created_or_edited_by) return unless SiteSetting.review_every_post return if post.post_type != Post.types[:regular] || post.topic.private_message? return if Reviewable.pending.where(target: post).exists? ... ``` And add something like ``` return if Reviewable.approved.where(target: post).exists? ``` However, because the callback happens in point 3. before the `ReviewableQueuePost` is linked to the `Topic`, it was not possible. Therefore, when `ReviewableQueuePost` is creating a `Topic`, a new option called `:reviewed_queued_post` is passed to `PostCreator` to avoid creating a second `Reviewable`. |
||
---|---|---|
.. | ||
assets | ||
controllers | ||
helpers | ||
jobs | ||
mailers | ||
models | ||
serializers | ||
services | ||
views |