mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-23 05:18:06 +01:00
Change closed_registrations_message
to message
and add Markdown (#19486)
This commit is contained in:
parent
371d969403
commit
09f04d710d
1 changed files with 13 additions and 1 deletions
|
@ -83,7 +83,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
||||||
{
|
{
|
||||||
enabled: registrations_enabled?,
|
enabled: registrations_enabled?,
|
||||||
approval_required: Setting.registrations_mode == 'approved',
|
approval_required: Setting.registrations_mode == 'approved',
|
||||||
closed_registrations_message: registrations_enabled? ? nil : Setting.closed_registrations_message,
|
message: registrations_enabled? ? nil : registrations_message,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -92,4 +92,16 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
||||||
def registrations_enabled?
|
def registrations_enabled?
|
||||||
Setting.registrations_mode != 'none' && !Rails.configuration.x.single_user_mode
|
Setting.registrations_mode != 'none' && !Rails.configuration.x.single_user_mode
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue