about summary refs log tree commit diff
path: root/app/models/form/status_batch.rb
diff options
context:
space:
mode:
authorJenkins <jenkins@jenkins.ninjawedding.org>2017-11-24 01:17:20 +0000
committerJenkins <jenkins@jenkins.ninjawedding.org>2017-11-24 01:17:20 +0000
commit167fe2ab08288ce286f5c7660ff0ed587b65b988 (patch)
tree1a4c7d23cb3dd6993c0ce57a637a161e3405dba5 /app/models/form/status_batch.rb
parentfaad820458401b5a01f24d4da4bf2acf59ef440d (diff)
parente84fecb7e97851ed56f4d954e2d68128bb87da37 (diff)
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'app/models/form/status_batch.rb')
-rw-r--r--app/models/form/status_batch.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/form/status_batch.rb b/app/models/form/status_batch.rb
index a97b4aa28..4f08a3049 100644
--- a/app/models/form/status_batch.rb
+++ b/app/models/form/status_batch.rb
@@ -2,8 +2,9 @@
 
 class Form::StatusBatch
   include ActiveModel::Model
+  include AccountableConcern
 
-  attr_accessor :status_ids, :action
+  attr_accessor :status_ids, :action, :current_account
 
   ACTION_TYPE = %w(nsfw_on nsfw_off delete).freeze
 
@@ -20,11 +21,14 @@ class Form::StatusBatch
 
   def change_sensitive(sensitive)
     media_attached_status_ids = MediaAttachment.where(status_id: status_ids).pluck(:status_id)
+
     ApplicationRecord.transaction do
       Status.where(id: media_attached_status_ids).find_each do |status|
         status.update!(sensitive: sensitive)
+        log_action :update, status
       end
     end
+
     true
   rescue ActiveRecord::RecordInvalid
     false
@@ -33,7 +37,9 @@ class Form::StatusBatch
   def delete_statuses
     Status.where(id: status_ids).find_each do |status|
       RemovalWorker.perform_async(status.id)
+      log_action :destroy, status
     end
+
     true
   end
 end