about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authornullkal <nullkal@nil.nu>2017-09-04 19:53:18 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-09-04 12:53:18 +0200
commit2293466edd0972c2069628c55baec9b0cb861445 (patch)
tree594fc0280be700cd1b2336204f45ebd1b26353d6 /app
parentb6f3869f8d600d319b3747b145b1d779869f8cc2 (diff)
Show pinned statuses only in the top of the profile page (#4803)
* Show pinned statuses only in the top of the profile page

* Refactor AccountsController#show_pinned_statuses?
Diffstat (limited to 'app')
-rw-r--r--app/controllers/accounts_controller.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb
index 8dad12f11..afa0417fa 100644
--- a/app/controllers/accounts_controller.rb
+++ b/app/controllers/accounts_controller.rb
@@ -14,7 +14,7 @@ class AccountsController < ApplicationController
           return
         end
 
-        @pinned_statuses = cache_collection(@account.pinned_statuses, Status) unless media_requested?
+        @pinned_statuses = cache_collection(@account.pinned_statuses, Status) if show_pinned_statuses?
         @statuses        = filtered_statuses.paginate_by_max_id(20, params[:max_id], params[:since_id])
         @statuses        = cache_collection(@statuses, Status)
         @next_url        = next_url unless @statuses.empty?
@@ -33,6 +33,10 @@ class AccountsController < ApplicationController
 
   private
 
+  def show_pinned_statuses?
+    [replies_requested?, media_requested?, params[:max_id].present?, params[:since_id].present?].none?
+  end
+
   def filtered_statuses
     default_statuses.tap do |statuses|
       statuses.merge!(only_media_scope) if media_requested?