mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-23 18:02:59 +01:00
22 lines
405 B
Ruby
22 lines
405 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Account::Silences
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
scope :silenced, -> { where.not(silenced_at: nil) }
|
|
scope :without_silenced, -> { where(silenced_at: nil) }
|
|
end
|
|
|
|
def silenced?
|
|
silenced_at.present?
|
|
end
|
|
|
|
def silence!(date = Time.now.utc)
|
|
update!(silenced_at: date)
|
|
end
|
|
|
|
def unsilence!
|
|
update!(silenced_at: nil)
|
|
end
|
|
end
|