diff options
author | ThibG <thib@sitedethib.com> | 2019-05-11 06:46:43 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2019-05-11 06:46:43 +0200 |
commit | 6d44f2441bf2aa14d11e481d9d2cfe82a74d81ed (patch) | |
tree | 80b436e6f6c0244b7a1f248bb62df1f2f1bf9db4 /app/serializers | |
parent | be851321c037a921e055b175d64d0b54d313f8b3 (diff) |
Add toot source to delete result to ease Delete & Redraft (#10669)
* Return Status with raw text in raw_content when deleting a status * Use raw content if available on delete & redraft * Rename raw_content to text; do not serialize formatted content when source is requested
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/rest/status_serializer.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb index 106777b6e..c9b76cb16 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? @@ -11,6 +11,9 @@ class REST::StatusSerializer < ActiveModel::Serializer attribute :muted, if: :current_user? attribute :pinned, if: :pinnable? + 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 @@ -105,6 +108,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 |