about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-03-28 02:16:01 +0100
committerGitHub <noreply@github.com>2019-03-28 02:16:01 +0100
commit08ec7435ce10fc74c257e089d6a2e909287e3daa (patch)
treeb529fdc6ee76c094b670a7409fe34f2cc0a4844c /app/controllers
parent683013756e9c57dd1944856dd154dba1be4097b9 (diff)
Add order options to relationship manager UI (#10404)
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/relationships_controller.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/controllers/relationships_controller.rb b/app/controllers/relationships_controller.rb
index 84cb178a6..e6705c327 100644
--- a/app/controllers/relationships_controller.rb
+++ b/app/controllers/relationships_controller.rb
@@ -31,13 +31,14 @@ class RelationshipsController < ApplicationController
   def relationships_scope
     scope = begin
       if following_relationship?
-        current_account.following.joins(:account_stat)
+        current_account.following.eager_load(:account_stat).reorder(nil)
       else
-        current_account.followers.joins(:account_stat)
+        current_account.followers.eager_load(:account_stat).reorder(nil)
       end
     end
 
-    scope.merge!(Follow.recent)
+    scope.merge!(Follow.recent)             if params[:order].blank? || params[:order] == 'recent'
+    scope.merge!(Account.by_recent_status)  if params[:order] == 'active'
     scope.merge!(mutual_relationship_scope) if mutual_relationship?
     scope.merge!(moved_account_scope)       if params[:status] == 'moved'
     scope.merge!(primary_account_scope)     if params[:status] == 'primary'
@@ -84,7 +85,7 @@ class RelationshipsController < ApplicationController
   end
 
   def current_params
-    params.slice(:page, :status, :relationship, :by_domain, :activity).permit(:page, :status, :relationship, :by_domain, :activity)
+    params.slice(:page, :status, :relationship, :by_domain, :activity, :order).permit(:page, :status, :relationship, :by_domain, :activity, :order)
   end
 
   def action_from_button