diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-11-04 16:31:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-04 16:31:44 +0100 |
commit | c2170991c7889b8f6c6434f416cb0a8450db25a1 (patch) | |
tree | 15da9dd2a375d5e0cbc3e1da97688096f7b30591 /app/models | |
parent | e02812d5b63b4909fff9c0c7246e80745c4c703e (diff) |
Fix reblogs being discarded after the reblogged status (#19731)
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/admin/status_batch_action.rb | 2 | ||||
-rw-r--r-- | app/models/status.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/app/models/admin/status_batch_action.rb b/app/models/admin/status_batch_action.rb index 0ec4fef82..0f019b854 100644 --- a/app/models/admin/status_batch_action.rb +++ b/app/models/admin/status_batch_action.rb @@ -44,7 +44,7 @@ class Admin::StatusBatchAction ApplicationRecord.transaction do statuses.each do |status| - status.discard + status.discard_with_reblogs log_action(:destroy, status) end diff --git a/app/models/status.rb b/app/models/status.rb index 4805abfea..8bdb5e8db 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -440,6 +440,12 @@ class Status < ApplicationRecord im end + def discard_with_reblogs + discard_time = Time.current + Status.unscoped.where(reblog_of_id: id, deleted_at: [nil, deleted_at]).in_batches.update_all(deleted_at: discard_time) unless reblog? + update_attribute(:deleted_at, discard_time) + end + private def update_status_stat!(attrs) |