FEATURE: plugins can register a custom admin quick start topic that will be seeded into new sites

This commit is contained in:
Neil Lalonde
2015-06-04 15:56:17 -04:00
parent 803083fc2e
commit f1637fc11e
4 changed files with 57 additions and 3 deletions

View File

@@ -54,6 +54,15 @@ if seed_welcome_topics
post.topic.update_pinned(true)
end
welcome = File.read(Rails.root + 'docs/ADMIN-QUICK-START-GUIDE.md')
PostCreator.create(Discourse.system_user, raw: welcome, title: "READ ME FIRST: Admin Quick Start Guide", skip_validations: true, category: staff ? staff.name : nil)
filename = DiscoursePluginRegistry.seed_data["admin_quick_start_filename"]
if filename.nil? || !File.exists?(filename)
filename = Rails.root + 'docs/ADMIN-QUICK-START-GUIDE.md'
end
welcome = File.read(filename)
PostCreator.create( Discourse.system_user,
raw: welcome,
title: DiscoursePluginRegistry.seed_data["admin_quick_start_title"] || "READ ME FIRST: Admin Quick Start Guide",
skip_validations: true,
category: staff ? staff.name : nil)
end