Skip to content
Snippets Groups Projects
Unverified Commit 09f04d71 authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

Change `closed_registrations_message` to `message` and add Markdown (#19486)

parent 371d9694
No related branches found
No related tags found
No related merge requests found
......@@ -83,7 +83,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer
{
enabled: registrations_enabled?,
approval_required: Setting.registrations_mode == 'approved',
closed_registrations_message: registrations_enabled? ? nil : Setting.closed_registrations_message,
message: registrations_enabled? ? nil : registrations_message,
}
end
......@@ -92,4 +92,16 @@ class REST::InstanceSerializer < ActiveModel::Serializer
def registrations_enabled?
Setting.registrations_mode != 'none' && !Rails.configuration.x.single_user_mode
end
def registrations_message
if Setting.closed_registrations_message.present?
markdown.render(Setting.closed_registrations_message)
else
nil
end
end
def markdown
@markdown ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML, no_images: true)
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment