Skip to content
Snippets Groups Projects
Commit 0230ca83 authored by Jan Provaznik's avatar Jan Provaznik
Browse files

Check if note's noteable is not nil when checking resolvability

This can occur when a note is added to a commit and then this commit
is deleted.
parent 4d674bd3
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -32,7 +32,7 @@ module ResolvableNote
 
# Keep this method in sync with the `potentially_resolvable` scope
def potentially_resolvable?
RESOLVABLE_TYPES.include?(self.class.name) && noteable.supports_resolvable_notes?
RESOLVABLE_TYPES.include?(self.class.name) && noteable&.supports_resolvable_notes?
end
 
# Keep this method in sync with the `resolvable` scope
Loading
Loading
---
title: Fix resolvable check if note's commit could not be found.
merge_request:
author:
type: fixed
Loading
Loading
@@ -326,4 +326,12 @@ describe Note, ResolvableNote do
end
end
end
describe "#potentially_resolvable?" do
it 'returns false if noteable could not be found' do
allow(subject).to receive(:noteable).and_return(nil)
expect(subject.potentially_resolvable?).to be_falsey
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment