FIX: Display pending posts in a moderated category

Currently we display pending posts in topics (both for author and staff
members) but the feature is only enabled when there’s an enabled global site
setting related to moderation.

This patch allows to have the same behavior for a site where there’s
nothing enabled globally but where a moderated category exists. So when
browsing a topic of a moderated category, the presence of pending posts
will be checked whereas nothing will happen in a normal category.
This commit is contained in:
Loïc Guitaut
2021-12-02 18:03:43 +01:00
committed by Loïc Guitaut
parent 412a6c0e8c
commit d0888c190e
3 changed files with 42 additions and 4 deletions

View File

@ -35,6 +35,7 @@ class TopicView
:personal_message,
:can_review_topic
)
alias queued_posts_enabled? queued_posts_enabled
attr_accessor(
:draft,
@ -45,6 +46,9 @@ class TopicView
:post_number
)
delegate :category, to: :topic, allow_nil: true, private: true
delegate :require_reply_approval?, to: :category, prefix: true, allow_nil: true, private: true
def self.print_chunk_size
1000
end
@ -146,7 +150,7 @@ class TopicView
@draft_sequence = DraftSequence.current(@user, @draft_key)
@can_review_topic = @guardian.can_review_topic?(@topic)
@queued_posts_enabled = NewPostManager.queue_enabled?
@queued_posts_enabled = NewPostManager.queue_enabled? || category_require_reply_approval?
@personal_message = @topic.private_message?
end