about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-03-01 20:48:11 +0100
committerGitHub <noreply@github.com>2018-03-01 20:48:11 +0100
commita3c413819746e5a496c9daeafcb0c4c7b6a63e5a (patch)
treefd48b4bb95d76676151e3b101ca8842d33cd82c2 /app
parent51b7a22ea78aa1d2e7f525c8925043ac609373ba (diff)
Add contact_account and languages to instance API (#6574)
Diffstat (limited to 'app')
-rw-r--r--app/serializers/rest/instance_serializer.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/serializers/rest/instance_serializer.rb b/app/serializers/rest/instance_serializer.rb
index ae1dbe6b5..e903604b2 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