From 9a3c4bc0511d1c8a19ef591752be59fb9f3cdfd8 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Sun, 4 Aug 2019 20:53:20 -0500 Subject: restrict private pin visibility to packmates & do not include them in `featured` collection (mainline masto does not respect pin visibility) --- app/controllers/accounts_controller.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'app/controllers/accounts_controller.rb') diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index bcc806b89..c00ff56b5 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -29,7 +29,7 @@ class AccountsController < ApplicationController end - @pinned_statuses = cache_collection(@account.pinned_statuses, Status) if show_pinned_statuses? + @pinned_statuses = cache_collection(pinned_statuses, Status) if show_pinned_statuses? @statuses = filtered_status_page(params) @statuses = cache_collection(@statuses, Status) @@ -51,6 +51,14 @@ class AccountsController < ApplicationController private + def pinned_statuses + if user_signed_in? && current_account.following?(@account) + @account.pinned_statuses + else + @account.pinned_statuses.where.not(visibility: :private) + end + end + def show_pinned_statuses? [reblogs_requested?, replies_requested?, media_requested?, tag_requested?, params[:max_id].present?, params[:min_id].present?].none? end -- cgit