Skip to content

Commit fd34900

Browse files
Gargronchrisguida
authored andcommitted
Fix nil error when removing status caused by race condition (mastodon#16099)
1 parent 05364c2 commit fd34900

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

app/lib/status_reach_finder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def replies_account_ids
6262
end
6363

6464
def followers_inboxes
65-
if @status.reply? && @status.thread.account.local? && @status.distributable?
65+
if @status.in_reply_to_local_account? && @status.distributable?
6666
@status.account.followers.or(@status.thread.account.followers).inboxes
6767
else
6868
@status.account.followers.inboxes

app/models/status.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ def local?
161161
attributes['local'] || uri.nil?
162162
end
163163

164+
def in_reply_to_local_account?
165+
reply? && thread&.account&.local?
166+
end
167+
164168
def reblog?
165169
!reblog_of_id.nil?
166170
end

app/workers/activitypub/distribution_worker.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def inboxes
3535
# Deliver the status to all followers.
3636
# If the status is a reply to another local status, also forward it to that
3737
# status' authors' followers.
38-
@inboxes ||= if @status.reply? && @status.thread.account.local? && @status.distributable?
38+
@inboxes ||= if @status.in_reply_to_local_account? && @status.distributable?
3939
@account.followers.or(@status.thread.account.followers).inboxes
4040
else
4141
@account.followers.inboxes

0 commit comments

Comments
 (0)