about summary refs log tree commit diff
path: root/app/serializers/rest
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers/rest')
-rw-r--r--app/serializers/rest/status_serializer.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb
index ab3788d75..86e887463 100644
--- a/app/serializers/rest/status_serializer.rb
+++ b/app/serializers/rest/status_serializer.rb
@@ -4,7 +4,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
   attributes :id, :created_at, :in_reply_to_id, :in_reply_to_account_id,
              :sensitive, :spoiler_text, :visibility, :language,
              :uri, :url, :replies_count, :reblogs_count,
-             :favourites_count
+             :favourites_count, :network, :curated
 
   attribute :favourited, if: :current_user?
   attribute :reblogged, if: :current_user?
@@ -12,6 +12,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
   attribute :bookmarked, if: :current_user?
   attribute :pinned, if: :pinnable?
   attribute :local_only if :local?
+  attribute :sharekey, if: :owner?
 
   attribute :content, unless: :source_requested?
   attribute :text, if: :source_requested?
@@ -45,8 +46,12 @@ class REST::StatusSerializer < ActiveModel::Serializer
     !current_user.nil?
   end
 
+  def owner?
+    current_user? && current_user.account_id == object.account_id
+  end
+
   def show_application?
-    object.account.user_shows_application? || (current_user? && current_user.account_id == object.account_id)
+    object.account.user_shows_application? || owner?
   end
 
   def visibility