about summary refs log tree commit diff
path: root/app/serializers/rest/status_serializer.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-02-02 19:18:15 +0100
committerEugen Rochko <eugen@zeonfederated.com>2019-02-02 19:18:15 +0100
commited3011061896dfc4819d517a0f4f4947e56feac4 (patch)
treedcdaba355bd827d379bcfe2d2b97551373e70c7f /app/serializers/rest/status_serializer.rb
parentbcfff65195f557dc086470f91b4c90b15c004cf7 (diff)
Make displaying application used to toot opt-in (#9897)
* Make storing and displaying application used to toot opt-in

* Revert to storing application info, and display it to the author via API
Diffstat (limited to 'app/serializers/rest/status_serializer.rb')
-rw-r--r--app/serializers/rest/status_serializer.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb
index bfc2d78b4..66e19be56 100644
--- a/app/serializers/rest/status_serializer.rb
+++ b/app/serializers/rest/status_serializer.rb
@@ -12,7 +12,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
   attribute :pinned, if: :pinnable?
 
   belongs_to :reblog, serializer: REST::StatusSerializer
-  belongs_to :application
+  belongs_to :application, if: :show_application?
   belongs_to :account, serializer: REST::AccountSerializer
 
   has_many :media_attachments, serializer: REST::MediaAttachmentSerializer
@@ -38,6 +38,10 @@ class REST::StatusSerializer < ActiveModel::Serializer
     !current_user.nil?
   end
 
+  def show_application?
+    object.account.user_shows_application? || (current_user? && current_user.account_id == object.account_id)
+  end
+
   def visibility
     # This visibility is masked behind "private"
     # to avoid API changes because there are no