]> cat aescling's git repositories - mastodon.git/commitdiff
Revert to storing application info, and display it to the author via API
authorThibaut Girka <thib@sitedethib.com>
Mon, 21 Jan 2019 21:40:26 +0000 (22:40 +0100)
committerThibG <thib@sitedethib.com>
Sun, 27 Jan 2019 12:56:41 +0000 (13:56 +0100)
app/serializers/rest/status_serializer.rb
app/services/post_status_service.rb

index f2b5febaefd42f0cac4b935274eacbe4b8adf841..b72eebb10224f4a431503485bc00f5eaab33b414 100644 (file)
@@ -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
index 24a85337340aa39ed80a362943adf51107886c88..e4b61ee35f8b54504c84c04bc4afa60d93f5755a 100644 (file)
@@ -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?