diff options
author | Starfall <us@starfall.systems> | 2022-03-22 11:16:06 -0500 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2022-03-22 11:16:06 -0500 |
commit | f37056e6c351a08d09c3986586cc7d27bdea85ab (patch) | |
tree | c28aaff7e0b70ba0fea07d4335777e6676bff60e /app/models/admin | |
parent | 239d67fc2c0ec82617de50a9831bc1a9efc30ecc (diff) | |
parent | 9ff119eecd1079e52a8a41d7b8d61520c4303c2f (diff) |
Merge remote-tracking branch 'glitch/main'
Diffstat (limited to 'app/models/admin')
-rw-r--r-- | app/models/admin/account_action.rb | 14 | ||||
-rw-r--r-- | app/models/admin/status_batch_action.rb | 4 |
2 files changed, 15 insertions, 3 deletions
diff --git a/app/models/admin/account_action.rb b/app/models/admin/account_action.rb index d3be4be3f..850ea6d82 100644 --- a/app/models/admin/account_action.rb +++ b/app/models/admin/account_action.rb @@ -22,6 +22,16 @@ class Admin::AccountAction attr_reader :warning, :send_email_notification, :include_statuses + alias send_email_notification? send_email_notification + alias include_statuses? include_statuses + + def initialize(attributes = {}) + @send_email_notification = true + @include_statuses = true + + super + end + def send_email_notification=(value) @send_email_notification = ActiveModel::Type::Boolean.new.cast(value) end @@ -141,11 +151,11 @@ class Admin::AccountAction end def warnable? - send_email_notification && target_account.local? + send_email_notification? && target_account.local? end def status_ids - report.status_ids if with_report? && include_statuses + report.status_ids if with_report? && include_statuses? end def reports diff --git a/app/models/admin/status_batch_action.rb b/app/models/admin/status_batch_action.rb index 4d91b9805..631af183c 100644 --- a/app/models/admin/status_batch_action.rb +++ b/app/models/admin/status_batch_action.rb @@ -68,6 +68,8 @@ class Admin::StatusBatchAction end def handle_mark_as_sensitive! + representative_account = Account.representative + # Can't use a transaction here because UpdateStatusService queues # Sidekiq jobs statuses.includes(:media_attachments, :preview_cards).find_each do |status| @@ -76,7 +78,7 @@ class Admin::StatusBatchAction authorize(status, :update?) if target_account.local? - UpdateStatusService.new.call(status, current_account.id, sensitive: true) + UpdateStatusService.new.call(status, representative_account.id, sensitive: true) else status.update(sensitive: true) end |