mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08: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:
@ -48,12 +48,18 @@ class TopicCreator
|
||||
save_topic(topic)
|
||||
create_warning(topic)
|
||||
watch_topic(topic)
|
||||
create_shared_draft(topic)
|
||||
|
||||
topic
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_shared_draft(topic)
|
||||
return unless @opts[:shared_draft] && @opts[:category].present?
|
||||
SharedDraft.create(topic_id: topic.id, category_id: @opts[:category])
|
||||
end
|
||||
|
||||
def create_warning(topic)
|
||||
return unless @opts[:is_warning]
|
||||
|
||||
@ -138,6 +144,10 @@ class TopicCreator
|
||||
# PM can't have a category
|
||||
@opts.delete(:category) if @opts[:archetype].present? && @opts[:archetype] == Archetype.private_message
|
||||
|
||||
if @opts[:shared_draft]
|
||||
return Category.find(SiteSetting.shared_drafts_category)
|
||||
end
|
||||
|
||||
# Temporary fix to allow older clients to create topics.
|
||||
# When all clients are updated the category variable should
|
||||
# be set directly to the contents of the if statement.
|
||||
|
Reference in New Issue
Block a user