Instances list in admin (#2095)

* Add admin/instances index action

* Add link to instances admin page

* View lists instances

* Instances, grouped by domain, ordered by count

* Use Account.remote scope

* Extract method: Account.by_domain_accounts
This commit is contained in:
Matt Jankowski 2017-04-18 15:09:07 -04:00 committed by Eugen
parent 66d8f99a30
commit 55e1503522
8 changed files with 66 additions and 0 deletions

View file

@ -68,6 +68,7 @@ class Account < ApplicationRecord
scope :suspended, -> { where(suspended: true) }
scope :recent, -> { reorder(id: :desc) }
scope :alphabetic, -> { order(domain: :asc, username: :asc) }
scope :by_domain_accounts, -> { group(:domain).select(:domain, 'COUNT(*) AS accounts_count').order('accounts_count desc') }
def follow!(other_account)
active_relationships.where(target_account: other_account).first_or_create!(target_account: other_account)