From 9bd95f11e57603438e44e46c2977dbd6e433c254 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Mon, 21 Jan 2019 22:40:26 +0100 Subject: [PATCH] Revert to storing application info, and display it to the author via API --- app/serializers/rest/status_serializer.rb | 6 +++--- app/services/post_status_service.rb | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb index f2b5febaef..b72eebb102 100644 --- a/app/serializers/rest/status_serializer.rb +++ b/app/serializers/rest/status_serializer.rb @@ -14,7 +14,7 @@ class REST::StatusSerializer < ActiveModel::Serializer attribute :local_only if :local? belongs_to :reblog, serializer: REST::StatusSerializer - belongs_to :application, if: :user_shows_application? + belongs_to :application, if: :show_application? belongs_to :account, serializer: REST::AccountSerializer has_many :media_attachments, serializer: REST::MediaAttachmentSerializer @@ -40,8 +40,8 @@ class REST::StatusSerializer < ActiveModel::Serializer !current_user.nil? end - def user_shows_application? - object.account.user_shows_application? + def show_application? + object.account.user_shows_application? || (current_user? && current_user.account_id == object.account_id) end def visibility diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index 24a8533734..e4b61ee35f 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -22,7 +22,6 @@ class PostStatusService < BaseService @options = options @text = @options[:text] || '' @in_reply_to = @options[:thread] - @options.delete(:application) unless @account.user&.setting_show_application return idempotency_duplicate if idempotency_given? && idempotency_duplicate?