From b6a5268e1b66303491efca3a5d1b310442c92e68 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 16 Feb 2019 05:23:47 +0100 Subject: [PATCH] Add registrations attribute to instance entity in REST API (#10060) Fix #9350 --- app/serializers/rest/instance_serializer.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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