Avoid 500's when commit is not reachable
This commit is contained in:
parent
d9a761ed14
commit
5a89bcc4da
|
@ -77,7 +77,7 @@ class DiffNote < Note
|
|||
end
|
||||
|
||||
def supports_suggestion?
|
||||
return false unless noteable.supports_suggestion? && on_text?
|
||||
return false unless noteable&.supports_suggestion? && on_text?
|
||||
# We don't want to trigger side-effects of `diff_file` call.
|
||||
return false unless file = latest_diff_file
|
||||
return false unless line = file.line_for_position(self.position)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Avoid 500 when rendering users ATOM data
|
||||
merge_request: 25408
|
||||
author:
|
||||
type: fixed
|
|
@ -321,6 +321,14 @@ describe DiffNote do
|
|||
end
|
||||
|
||||
describe '#supports_suggestion?' do
|
||||
context 'when noteable does not exist' do
|
||||
it 'returns false' do
|
||||
allow(subject).to receive(:noteable) { nil }
|
||||
|
||||
expect(subject.supports_suggestion?).to be(false)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when noteable does not support suggestions' do
|
||||
it 'returns false' do
|
||||
allow(subject.noteable).to receive(:supports_suggestion?) { false }
|
||||
|
|
Loading…
Reference in New Issue