FEATURE: allows published pages to be public (#10053)

This commit is contained in:
Joffrey JAFFEUX
2020-06-17 12:42:20 +02:00
committed by GitHub
parent 7d289a4f3e
commit 9da3a7f436
14 changed files with 196 additions and 30 deletions

View File

@ -23,12 +23,13 @@ class PublishedPage < ActiveRecord::Base
"#{Discourse.base_url}#{path}"
end
def self.publish!(publisher, topic, slug)
def self.publish!(publisher, topic, slug, options = {})
pp = nil
transaction do
pp = find_or_initialize_by(topic: topic)
pp.slug = slug.strip
pp.public = options[:public] || false
if pp.save
StaffActionLogger.new(publisher).log_published_page(topic.id, slug)
@ -56,6 +57,7 @@ end
# slug :string not null
# created_at :datetime not null
# updated_at :datetime not null
# public :boolean default(FALSE), not null
#
# Indexes
#