1
0
mirror of https://github.com/mastodon/mastodon synced 2024-12-18 08:38:20 +09:00

Add check for visibility.nil? even though it can't ever be, to check for race conditions

This commit is contained in:
Eugen Rochko 2017-04-03 22:54:46 +02:00
parent 98a93aa07e
commit 8232f76c48
2 changed files with 3 additions and 0 deletions

View File

@ -4,4 +4,5 @@ module Mastodon
class Error < StandardError; end class Error < StandardError; end
class NotPermittedError < Error; end class NotPermittedError < Error; end
class ValidationError < Error; end class ValidationError < Error; end
class RaceConditionError < Error; end
end end

View File

@ -4,6 +4,8 @@ class FanOutOnWriteService < BaseService
# Push a status into home and mentions feeds # Push a status into home and mentions feeds
# @param [Status] status # @param [Status] status
def call(status) def call(status)
raise Mastodon::RaceConditionError if status.visibility.nil?
deliver_to_self(status) if status.account.local? deliver_to_self(status) if status.account.local?
if status.direct_visibility? if status.direct_visibility?