about summary refs log tree commit diff
path: root/app/serializers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-10-12 04:04:08 +0200
committerGitHub <noreply@github.com>2018-10-12 04:04:08 +0200
commit9d4541c612b506889675c4c19ced5cd17ad3710f (patch)
tree1b2944fe0ae4f40e68701d5c3b27753c4bc16b5b /app/serializers
parent22de24b8ca707d8eac26eab6615377a290ff1f4e (diff)
Display customized mascot in web UI and fix admin form for it (#8964)
Follow-up to #8766
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/initial_state_serializer.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/serializers/initial_state_serializer.rb b/app/serializers/initial_state_serializer.rb
index cdc470831..57f1e0098 100644
--- a/app/serializers/initial_state_serializer.rb
+++ b/app/serializers/initial_state_serializer.rb
@@ -16,6 +16,7 @@ class InitialStateSerializer < ActiveModel::Serializer
       search_enabled: Chewy.enabled?,
       version: Mastodon::Version.to_s,
       invites_enabled: Setting.min_invite_role == 'user',
+      mascot: instance_presenter.mascot&.file&.url,
     }
 
     if object.current_account
@@ -56,4 +57,10 @@ class InitialStateSerializer < ActiveModel::Serializer
   def media_attachments
     { accept_content_types: MediaAttachment::IMAGE_FILE_EXTENSIONS + MediaAttachment::VIDEO_FILE_EXTENSIONS + MediaAttachment::IMAGE_MIME_TYPES + MediaAttachment::VIDEO_MIME_TYPES }
   end
+
+  private
+
+  def instance_presenter
+    @instance_presenter ||= InstancePresenter.new
+  end
 end