diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2020-01-24 00:20:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-24 00:20:23 +0100 |
commit | ce1dee85b58fb7ab41af7ea1d276853630ce59a0 (patch) | |
tree | 2e69928e6e0522043f661dbbb8c66dcae69923d0 /app | |
parent | dee853f23c65988d505796d11ac71c0fd2f8053e (diff) |
Fix relationships page not showing results in admin UI (#12934)
Follow-up to #12927
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin/relationships_controller.rb | 2 | ||||
-rw-r--r-- | app/models/relationship_filter.rb | 20 | ||||
-rw-r--r-- | app/views/admin/accounts/show.html.haml | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/app/controllers/admin/relationships_controller.rb b/app/controllers/admin/relationships_controller.rb index 07d121340..f8a95cfc8 100644 --- a/app/controllers/admin/relationships_controller.rb +++ b/app/controllers/admin/relationships_controller.rb @@ -19,7 +19,7 @@ module Admin end def filter_params - params.slice(RelationshipFilter::KEYS).permit(RelationshipFilter::KEYS) + params.slice(*RelationshipFilter::KEYS).permit(*RelationshipFilter::KEYS) end end end diff --git a/app/models/relationship_filter.rb b/app/models/relationship_filter.rb index fcb3a8dc5..e6859bf3d 100644 --- a/app/models/relationship_filter.rb +++ b/app/models/relationship_filter.rb @@ -20,12 +20,12 @@ class RelationshipFilter end def results - scope = scope_for('relationship', params['relationship']) + scope = scope_for('relationship', params['relationship'].to_s.strip) params.each do |key, value| next if key.to_s == 'page' - scope.merge!(scope_for(key, value)) if value.present? + scope.merge!(scope_for(key.to_s, value.to_s.strip)) if value.present? end scope @@ -39,7 +39,7 @@ class RelationshipFilter end def scope_for(key, value) - case key.to_s + case key when 'relationship' relationship_scope(value) when 'by_domain' @@ -58,7 +58,7 @@ class RelationshipFilter end def relationship_scope(value) - case value.to_s + case value when 'following' account.following.eager_load(:account_stat).reorder(nil) when 'followed_by' @@ -73,11 +73,11 @@ class RelationshipFilter end def by_domain_scope(value) - Account.where(domain: value.to_s) + Account.where(domain: value) end def location_scope(value) - case value.to_s + case value when 'local' Account.local when 'remote' @@ -88,7 +88,7 @@ class RelationshipFilter end def status_scope(value) - case value.to_s + case value when 'moved' Account.where.not(moved_to_account_id: nil) when 'primary' @@ -99,18 +99,18 @@ class RelationshipFilter end def order_scope(value) - case value.to_s + case value when 'active' Account.by_recent_status when 'recent' - Follow.recent + params[:relationship] == 'invited' ? Account.recent : Follow.recent else raise "Unknown order: #{value}" end end def activity_scope(value) - case value.to_s + case value when 'dormant' AccountStat.where(last_status_at: nil).or(AccountStat.where(AccountStat.arel_table[:last_status_at].lt(1.month.ago))) else diff --git a/app/views/admin/accounts/show.html.haml b/app/views/admin/accounts/show.html.haml index f191d8f25..a83f77134 100644 --- a/app/views/admin/accounts/show.html.haml +++ b/app/views/admin/accounts/show.html.haml @@ -41,7 +41,7 @@ .dashboard__counters__num= number_to_human_size @account.media_attachments.sum('file_file_size') .dashboard__counters__label= t 'admin.accounts.media_attachments' %div - = link_to admin_account_relationships_path(@account.id, location: 'local') do + = link_to admin_account_relationships_path(@account.id, location: 'local', relationship: 'followed_by') do .dashboard__counters__num= number_with_delimiter @account.local_followers_count .dashboard__counters__label= t 'admin.accounts.followers' %div |