]> cat aescling's git repositories - mastodon.git/commitdiff
Fix nil error when removing status caused by race condition (#16099)
authorEugen Rochko <eugen@zeonfederated.com>
Sat, 24 Apr 2021 11:35:39 +0000 (13:35 +0200)
committerGitHub <noreply@github.com>
Sat, 24 Apr 2021 11:35:39 +0000 (13:35 +0200)
app/lib/status_reach_finder.rb
app/models/status.rb
app/workers/activitypub/distribution_worker.rb

index 0e755d433f35b4ded7faac400ed2650f92d0f681..735d66a4f78c7a176ada2228c11183c2c5b09b44 100644 (file)
@@ -62,7 +62,7 @@ class StatusReachFinder
   end
 
   def followers_inboxes
-    if @status.reply? && @status.thread.account.local? && @status.distributable?
+    if @status.in_reply_to_local_account? && @status.distributable?
       @status.account.followers.or(@status.thread.account.followers).inboxes
     else
       @status.account.followers.inboxes
index 74e81f6127cdb5c7d01538cb1fc61c70b882954d..847921ac233dfbd13f54b11b5fb6f685471d6e57 100644 (file)
@@ -161,6 +161,10 @@ class Status < ApplicationRecord
     attributes['local'] || uri.nil?
   end
 
+  def in_reply_to_local_account?
+    reply? && thread&.account&.local?
+  end
+
   def reblog?
     !reblog_of_id.nil?
   end
index 9b4814644f278a829de4430bed00f6f069e1a7db..09898ca49eece1fd2e78616dfe0e1b0d0a45884c 100644 (file)
@@ -35,7 +35,7 @@ class ActivityPub::DistributionWorker
     # Deliver the status to all followers.
     # If the status is a reply to another local status, also forward it to that
     # status' authors' followers.
-    @inboxes ||= if @status.reply? && @status.thread.account.local? && @status.distributable?
+    @inboxes ||= if @status.in_reply_to_local_account? && @status.distributable?
                    @account.followers.or(@status.thread.account.followers).inboxes
                  else
                    @account.followers.inboxes