Skip to content

Commit

Permalink
Fix nil error when removing status caused by race condition (mastodon…
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored and chrisguida committed Feb 26, 2022
1 parent 05364c2 commit fd34900
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/lib/status_reach_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def replies_account_ids
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
Expand Down
4 changes: 4 additions & 0 deletions app/models/status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ def local?
attributes['local'] || uri.nil?
end

def in_reply_to_local_account?
reply? && thread&.account&.local?
end

def reblog?
!reblog_of_id.nil?
end
Expand Down
2 changes: 1 addition & 1 deletion app/workers/activitypub/distribution_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def inboxes
# 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
Expand Down

0 comments on commit fd34900

Please sign in to comment.