mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-29 03:53:52 +00:00
23 lines
405 B
Ruby
23 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
|