diff --git a/app/models/account.rb b/app/models/account.rb index 2bf00b2be5..9946c37186 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -82,6 +82,7 @@ class Account < ApplicationRecord include Account::Interactions include Account::Merging include Account::Search + include Account::Sensitizes include Account::StatusesSearch include DomainMaterializable include DomainNormalizable @@ -118,7 +119,6 @@ class Account < ApplicationRecord scope :partitioned, -> { order(Arel.sql('row_number() over (partition by domain)')) } scope :silenced, -> { where.not(silenced_at: nil) } scope :suspended, -> { where.not(suspended_at: nil) } - scope :sensitized, -> { where.not(sensitized_at: nil) } scope :without_suspended, -> { where(suspended_at: nil) } scope :without_silenced, -> { where(silenced_at: nil) } scope :without_instance_actor, -> { where.not(id: INSTANCE_ACTOR_ID) } @@ -272,18 +272,6 @@ class Account < ApplicationRecord end end - def sensitized? - sensitized_at.present? - end - - def sensitize!(date = Time.now.utc) - update!(sensitized_at: date) - end - - def unsensitize! - update!(sensitized_at: nil) - end - def memorialize! update!(memorial: true) end diff --git a/app/models/concerns/account/sensitizes.rb b/app/models/concerns/account/sensitizes.rb new file mode 100644 index 0000000000..3bb74324a8 --- /dev/null +++ b/app/models/concerns/account/sensitizes.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Account::Sensitizes + extend ActiveSupport::Concern + + included do + scope :sensitized, -> { where.not(sensitized_at: nil) } + end + + def sensitized? + sensitized_at.present? + end + + def sensitize!(date = Time.now.utc) + update!(sensitized_at: date) + end + + def unsensitize! + update!(sensitized_at: nil) + end +end