Kaynağa Gözat

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

master
Eugen Rochko 7 yıl önce
ebeveyn
işleme
8232f76c48
2 değiştirilmiş dosya ile 3 ekleme ve 0 silme
  1. +1
    -0
      app/lib/exceptions.rb
  2. +2
    -0
      app/services/fan_out_on_write_service.rb

+ 1
- 0
app/lib/exceptions.rb Dosyayı Görüntüle

@@ -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

+ 2
- 0
app/services/fan_out_on_write_service.rb Dosyayı Görüntüle

@@ -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?


Yükleniyor…
İptal
Kaydet