From c421ad685d90f8f6cf79f38384b6cf6ff7f3dba8 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 1 Mar 2018 20:48:11 +0100 Subject: [PATCH] Add contact_account and languages to instance API (#6574) --- app/serializers/rest/instance_serializer.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/serializers/rest/instance_serializer.rb b/app/serializers/rest/instance_serializer.rb index ae1dbe6b59..e903604b26 100644 --- a/app/serializers/rest/instance_serializer.rb +++ b/app/serializers/rest/instance_serializer.rb @@ -4,7 +4,12 @@ class REST::InstanceSerializer < ActiveModel::Serializer include RoutingHelper attributes :uri, :title, :description, :email, - :version, :urls, :stats, :thumbnail + :version, :urls, :stats, :thumbnail, + :languages + + has_one :contact_account, serializer: REST::AccountSerializer + + delegate :contact_account, to: :instance_presenter def uri Rails.configuration.x.local_domain @@ -42,6 +47,10 @@ class REST::InstanceSerializer < ActiveModel::Serializer { streaming_api: Rails.configuration.x.streaming_api_base_url } end + def languages + [ENV.fetch('DEFAULT_LOCALE', I18n.default_locale)] + end + private def instance_presenter