about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-06-22 12:08:16 +0200
committerGitHub <noreply@github.com>2019-06-22 12:08:16 +0200
commitd61d16468597a824ca5b0cd21c8450b87d135c07 (patch)
tree5dc53625e80b536626e8c0ed6d768b110e2fab27 /app
parentaa9b37822bd39dff771844b7b1ac149e37788d34 (diff)
Add `short_description` and `approval_required` to `GET /api/v1/instance` (#11146)
Diffstat (limited to 'app')
-rw-r--r--app/serializers/rest/instance_serializer.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/serializers/rest/instance_serializer.rb b/app/serializers/rest/instance_serializer.rb
index a82eff195..1bd71683c 100644
--- a/app/serializers/rest/instance_serializer.rb
+++ b/app/serializers/rest/instance_serializer.rb
@@ -3,9 +3,9 @@
 class REST::InstanceSerializer < ActiveModel::Serializer
   include RoutingHelper
 
-  attributes :uri, :title, :description, :email,
+  attributes :uri, :title, :short_description, :description, :email,
              :version, :urls, :stats, :thumbnail,
-             :languages, :registrations
+             :languages, :registrations, :approval_required
 
   has_one :contact_account, serializer: REST::AccountSerializer
 
@@ -19,6 +19,10 @@ class REST::InstanceSerializer < ActiveModel::Serializer
     Setting.site_title
   end
 
+  def short_description
+    Setting.site_short_description
+  end
+
   def description
     Setting.site_description
   end
@@ -55,6 +59,10 @@ class REST::InstanceSerializer < ActiveModel::Serializer
     Setting.registrations_mode != 'none' && !Rails.configuration.x.single_user_mode
   end
 
+  def approval_required
+    Setting.registrations_mode == 'approved'
+  end
+
   private
 
   def instance_presenter