about summary refs log tree commit diff
path: root/app/serializers
diff options
context:
space:
mode:
authorReverite <github@reverite.sh>2019-05-11 18:06:12 -0700
committerReverite <github@reverite.sh>2019-05-11 18:06:12 -0700
commitcdb159f27e2aeb2cf3bb184ac20b7056b013f714 (patch)
tree01a185cccbaedb031eaf592706349907dc6decd4 /app/serializers
parentb403052b6759c8a87fc8e20304c0c31c05412313 (diff)
parentf6838a28f64a2e1a955d7062d8b4270312df802f (diff)
Merge branch 'glitch' into production
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/rest/status_serializer.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb
index a7b797368..906f489db 100644
--- a/app/serializers/rest/status_serializer.rb
+++ b/app/serializers/rest/status_serializer.rb
@@ -3,7 +3,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, :content, :url, :replies_count, :reblogs_count,
+             :uri, :url, :replies_count, :reblogs_count,
              :favourites_count
 
   attribute :favourited, if: :current_user?
@@ -13,6 +13,9 @@ class REST::StatusSerializer < ActiveModel::Serializer
   attribute :pinned, if: :pinnable?
   attribute :local_only if :local?
 
+  attribute :content, unless: :source_requested?
+  attribute :text, if: :source_requested?
+
   belongs_to :reblog, serializer: REST::StatusSerializer
   belongs_to :application, if: :show_application?
   belongs_to :account, serializer: REST::AccountSerializer
@@ -115,6 +118,10 @@ class REST::StatusSerializer < ActiveModel::Serializer
       %w(public unlisted).include?(object.visibility)
   end
 
+  def source_requested?
+    instance_options[:source_requested]
+  end
+
   def ordered_mentions
     object.active_mentions.to_a.sort_by(&:id)
   end