mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Shared Drafts
This feature can be enabled by choosing a destination for the `shared drafts category` site setting. * Staff members can create shared drafts, choosing a destination category for the topic when it is published. * Shared Drafts can be viewed in their category, or above the topic list for the destination category where it will end up. * When the shared draft is ready, it can be published to the appropriate category by clicking a button on the topic view. * When published, Drafts change their timestamps to the current time, and any edits to the original post are removed.
This commit is contained in:
@@ -44,7 +44,8 @@ class TopicQuery
|
||||
per_page
|
||||
visible
|
||||
guardian
|
||||
no_definitions)
|
||||
no_definitions
|
||||
destination_category_id)
|
||||
end
|
||||
|
||||
# Maps `order` to a columns in `topics`
|
||||
@@ -606,6 +607,11 @@ class TopicQuery
|
||||
result = apply_ordering(result, options)
|
||||
result = result.listable_topics.includes(:category)
|
||||
|
||||
if options[:destination_category_id]
|
||||
destination_category_id = get_category_id(options[:destination_category_id])
|
||||
result = result.includes(:shared_draft).where("shared_drafts.category_id" => destination_category_id)
|
||||
end
|
||||
|
||||
if options[:exclude_category_ids] && options[:exclude_category_ids].is_a?(Array) && options[:exclude_category_ids].size > 0
|
||||
result = result.where("categories.id NOT IN (?)", options[:exclude_category_ids]).references(:categories)
|
||||
end
|
||||
|
Reference in New Issue
Block a user