Merge branch 'jprovazn-fix-resolvable' into 'master'
Check if note's noteable is not nil when checking resolvability Closes #46573 See merge request gitlab-org/gitlab-ce!19081
This commit is contained in:
		
						commit
						56d2d46227
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
---
 | 
			
		||||
title: Fix resolvable check if note's commit could not be found.
 | 
			
		||||
merge_request:
 | 
			
		||||
author:
 | 
			
		||||
type: fixed
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue