0
0
Fork 0

Add suspend account functionality to admin UI

This commit is contained in:
Eugen Rochko 2016-12-06 18:22:59 +01:00
parent f406e01fcf
commit f978b06dd1
7 changed files with 56 additions and 13 deletions

View file

@ -58,6 +58,10 @@ class Account < ApplicationRecord
scope :without_followers, -> { where('(select count(f.id) from follows as f where f.target_account_id = accounts.id) = 0') }
scope :with_followers, -> { where('(select count(f.id) from follows as f where f.target_account_id = accounts.id) > 0') }
scope :expiring, ->(time) { where(subscription_expires_at: nil).or(where('subscription_expires_at < ?', time)).remote.with_followers }
scope :silenced, -> { where(silenced: true) }
scope :suspended, -> { where(suspended: true) }
scope :recent, -> { reorder('id desc') }
scope :alphabetic, -> { order('domain ASC, username ASC') }
def follow!(other_account)
active_relationships.where(target_account: other_account).first_or_create!(target_account: other_account)