|
3 | 3 | class REST::StatusSerializer < ActiveModel::Serializer |
4 | 4 | attributes :id, :created_at, :in_reply_to_id, :in_reply_to_account_id, |
5 | 5 | :sensitive, :spoiler_text, :visibility, :language, |
6 | | - :uri, :content, :url, :replies_count, :reblogs_count, |
| 6 | + :uri, :url, :replies_count, :reblogs_count, |
7 | 7 | :favourites_count |
8 | 8 |
|
9 | 9 | attribute :favourited, if: :current_user? |
10 | 10 | attribute :reblogged, if: :current_user? |
11 | 11 | attribute :muted, if: :current_user? |
12 | 12 | attribute :pinned, if: :pinnable? |
13 | 13 |
|
| 14 | + attribute :content, unless: :source_requested? |
| 15 | + attribute :text, if: :source_requested? |
| 16 | + |
14 | 17 | belongs_to :reblog, serializer: REST::StatusSerializer |
15 | 18 | belongs_to :application, if: :show_application? |
16 | 19 | belongs_to :account, serializer: REST::AccountSerializer |
@@ -105,6 +108,10 @@ def pinnable? |
105 | 108 | %w(public unlisted).include?(object.visibility) |
106 | 109 | end |
107 | 110 |
|
| 111 | + def source_requested? |
| 112 | + instance_options[:source_requested] |
| 113 | + end |
| 114 | + |
108 | 115 | def ordered_mentions |
109 | 116 | object.active_mentions.to_a.sort_by(&:id) |
110 | 117 | end |
|
0 commit comments