FIX: Existing shared drafts should be accessible (#11915)

Disabling shared drafts used to leave topics in an inconsistent state
where they were not displayed as shared drafts and thus there was no
way of publishing them. Moreover, they were accessible just to users
who have permissions to create shared drafts.

This commit adds another permission check that is used for most
operations and the old can_create_shared_draft? remains used just when
creating a new shared draft.
This commit is contained in:
Dan Ungureanu
2021-02-01 16:16:34 +02:00
committed by GitHub
parent f113648107
commit dd175537f3
9 changed files with 42 additions and 12 deletions

View File

@ -617,9 +617,8 @@ class TopicQuery
drafts_category_id = SiteSetting.shared_drafts_category.to_i
viewing_shared = category_id && category_id == drafts_category_id
can_create_shared = guardian.can_create_shared_draft?
if can_create_shared
if guardian.can_see_shared_draft?
if options[:destination_category_id]
destination_category_id = get_category_id(options[:destination_category_id])
topic_ids = SharedDraft.where(category_id: destination_category_id).pluck(:topic_id)