diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2022-10-27 19:17:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-27 19:17:48 +0200 |
commit | 09f04d710d2b3acbd604ca1678c59c4bd5edfa78 (patch) | |
tree | 1f9fecbf72ab373c63608e2876970ad9fd522c32 | |
parent | 371d96940342b616723df36d54e6c2d1ab3ca827 (diff) |
Change `closed_registrations_message` to `message` and add Markdown (#19486)
-rw-r--r-- | app/serializers/rest/instance_serializer.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/app/serializers/rest/instance_serializer.rb b/app/serializers/rest/instance_serializer.rb index 2a4da8c3b..5ae1099d0 100644 --- a/app/serializers/rest/instance_serializer.rb +++ b/app/serializers/rest/instance_serializer.rb @@ -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 |