]> cat aescling's git repositories - mastodon.git/commitdiff
Hide local-only pinned toots from public profiles
authorThibaut Girka <thib@sitedethib.com>
Sun, 31 May 2020 14:11:02 +0000 (16:11 +0200)
committerThibG <thib@sitedethib.com>
Sun, 31 May 2020 15:20:15 +0000 (17:20 +0200)
Fixes #1336

This also fixes federating pinned toots when some of them are local-only.

Public profiles will not show public toots, whether you are logged in
or not (this is consistent with local-only toots that are not pinned).

app/controllers/accounts_controller.rb
app/controllers/activitypub/collections_controller.rb

index e3d8c1061b4141c27bd42c2f2d42d06c051d7fe9..76703ed0581a958123f0a316d894b4ac4a0f936f 100644 (file)
@@ -27,7 +27,7 @@ class AccountsController < ApplicationController
           return
         end
 
-        @pinned_statuses = cache_collection(@account.pinned_statuses, Status) if show_pinned_statuses?
+        @pinned_statuses = cache_collection(@account.pinned_statuses.not_local_only, Status) if show_pinned_statuses?
         @statuses        = filtered_status_page
         @statuses        = cache_collection(@statuses, Status)
         @rss_url         = rss_url
index c1e7aa550239bc67a45f7d4e45d8f980e8f35292..9ca216e4fa728f509f326003ccfb3812c9feb1eb 100644 (file)
@@ -24,7 +24,7 @@ class ActivityPub::CollectionsController < ActivityPub::BaseController
   def set_size
     case params[:id]
     when 'featured'
-      @size = @account.pinned_statuses.count
+      @size = @account.pinned_statuses.not_local_only.count
     else
       not_found
     end
@@ -39,7 +39,7 @@ class ActivityPub::CollectionsController < ActivityPub::BaseController
       if authorized_fetch_mode? && !signed_request_account.nil? && (@account.blocking?(signed_request_account) || (!signed_request_account.domain.nil? && @account.domain_blocking?(signed_request_account.domain)))
         Status.none
       else
-        @account.pinned_statuses
+        @account.pinned_statuses.not_local_only
       end
     end
   end