about summary refs log tree commit diff
path: root/app/models/status.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-11-04 16:31:44 +0100
committerGitHub <noreply@github.com>2022-11-04 16:31:44 +0100
commitc2170991c7889b8f6c6434f416cb0a8450db25a1 (patch)
tree15da9dd2a375d5e0cbc3e1da97688096f7b30591 /app/models/status.rb
parente02812d5b63b4909fff9c0c7246e80745c4c703e (diff)
Fix reblogs being discarded after the reblogged status (#19731)
Diffstat (limited to 'app/models/status.rb')
-rw-r--r--app/models/status.rb6
1 files changed, 6 insertions, 0 deletions
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)