about summary refs log tree commit diff
path: root/app/serializers/nodeinfo
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-10-02 21:02:48 +0200
committerGitHub <noreply@github.com>2019-10-02 21:02:48 +0200
commit4e1afef6f9eb29714c72e2c67b16569e22558f66 (patch)
tree218f7e29360b8bbc53b514a85df0cf2fd1848763 /app/serializers/nodeinfo
parent575dc11cb2045c32b8fc0325de7bc321bd4728aa (diff)
Add `openRegistrations` attribute to nodeinfo endpoint (#12058)
Diffstat (limited to 'app/serializers/nodeinfo')
-rw-r--r--app/serializers/nodeinfo/serializer.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/serializers/nodeinfo/serializer.rb b/app/serializers/nodeinfo/serializer.rb
index 1a7d7a911..7ff8aabec 100644
--- a/app/serializers/nodeinfo/serializer.rb
+++ b/app/serializers/nodeinfo/serializer.rb
@@ -3,7 +3,7 @@
 class NodeInfo::Serializer < ActiveModel::Serializer
   include RoutingHelper
 
-  attributes :version, :software, :protocols, :usage
+  attributes :version, :software, :protocols, :usage, :open_registrations
 
   def version
     '2.0'
@@ -33,6 +33,10 @@ class NodeInfo::Serializer < ActiveModel::Serializer
     }
   end
 
+  def open_registrations
+    Setting.registrations_mode != 'none' && !Rails.configuration.x.single_user_mode
+  end
+
   private
 
   def instance_presenter