before_action :check_account_suspension, only: [:show]
before_action :check_enabled_registrations, only: [:create]
+ skip_before_action :require_authenticated_user!, only: :create
+
respond_to :json
def show
def follow
FollowService.new.call(current_user.account, @account, reblogs: truthy_param?(:reblogs))
- options = @account.locked? ? {} : { following_map: { @account.id => { reblogs: truthy_param?(:reblogs) } }, requested_map: { @account.id => false } }
+ options = @account.locked? || current_user.account.silenced? ? {} : { following_map: { @account.id => { reblogs: truthy_param?(:reblogs) } }, requested_map: { @account.id => false } }
render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships(options)
end
end
def check_enabled_registrations
- forbidden if single_user_mode? || !Setting.open_registrations
+ forbidden if single_user_mode? || !allowed_registrations?
+ end
+
+ def allowed_registrations?
+ Setting.registrations_mode != 'none'
end
end