mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
FIX: Users without shared drafts access can still have access to the category. (#11476)
This is an edge-case of 9fb3629. An admin could set the shared draft category to one where both TL2 and TL3 users have access but only give shared draft access to TL3 users. If something like this happens, we need to make sure that TL2 users won't be able to see them, and they won't be listed on latest. Before this change, `SharedDrafts` were lazily created when a destination category was selected. We now create it alongside the topic and set the destination to the same shared draft category.
This commit is contained in:
@ -56,8 +56,10 @@ class TopicCreator
|
||||
private
|
||||
|
||||
def create_shared_draft(topic)
|
||||
return unless @opts[:shared_draft] && @opts[:category].present?
|
||||
SharedDraft.create(topic_id: topic.id, category_id: @opts[:category])
|
||||
return if @opts[:shared_draft].blank? || @opts[:shared_draft] == 'false'
|
||||
|
||||
category_id = @opts[:category].blank? ? SiteSetting.shared_drafts_category.to_i : @opts[:category]
|
||||
SharedDraft.create(topic_id: topic.id, category_id: category_id)
|
||||
end
|
||||
|
||||
def create_warning(topic)
|
||||
|
Reference in New Issue
Block a user