about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-02-16 05:23:47 +0100
committerGitHub <noreply@github.com>2019-02-16 05:23:47 +0100
commita006d4afbe0b57cba9c7bcbd656131319c5c2965 (patch)
tree964ace672491e1809cd90d7ff8cefcb9e6cbfde9
parent80388a3ffe654f5aec0dc94ce9976b4e9fe257ae (diff)
Add registrations attribute to instance entity in REST API (#10060)
Fix #9350
-rw-r--r--app/serializers/rest/instance_serializer.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/serializers/rest/instance_serializer.rb b/app/serializers/rest/instance_serializer.rb
index e3e64ea87..216808ffb 100644
--- a/app/serializers/rest/instance_serializer.rb
+++ b/app/serializers/rest/instance_serializer.rb
@@ -5,7 +5,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer
 
   attributes :uri, :title, :description, :email,
              :version, :urls, :stats, :thumbnail,
-             :languages
+             :languages, :registrations
 
   has_one :contact_account, serializer: REST::AccountSerializer
 
@@ -51,6 +51,10 @@ class REST::InstanceSerializer < ActiveModel::Serializer
     [I18n.default_locale]
   end
 
+  def registrations
+    Setting.open_registrations && !Rails.configuration.x.single_user_mode
+  end
+
   private
 
   def instance_presenter