]> cat aescling's git repositories - mastodon.git/commitdiff
Add `openRegistrations` attribute to nodeinfo endpoint (#12058)
authorEugen Rochko <eugen@zeonfederated.com>
Wed, 2 Oct 2019 19:02:48 +0000 (21:02 +0200)
committerGitHub <noreply@github.com>
Wed, 2 Oct 2019 19:02:48 +0000 (21:02 +0200)
app/serializers/nodeinfo/serializer.rb

index 1a7d7a911397a09af6de4c65b2b4522835acd92f..7ff8aabecc56c50eddde2294511bc26635a3d646 100644 (file)
@@ -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