Fix ReferenceExtractor
The cross-project reference feature broke the ReferenceExtractor class; this fixes it.
This commit is contained in:
		
							parent
							
								
									1b1ba6b0a5
								
							
						
					
					
						commit
						7edc1439fe
					
				| 
						 | 
					@ -146,13 +146,15 @@ module Gitlab
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Called from #parse_references.  Attempts to build a gitlab reference
 | 
					    # Called from #parse_references.  Attempts to build a gitlab reference
 | 
				
			||||||
    # link.  Returns nil if either +type+ or +project+ are nil, if the match
 | 
					    # link.  Returns nil if +type+ is nil, if the match string is an HTML
 | 
				
			||||||
    # string is an HTML entity, or if the reference is invalid.
 | 
					    # entity, if the reference is invalid, or if the matched text includes an
 | 
				
			||||||
 | 
					    # invalid project path.
 | 
				
			||||||
    def parse_result(match_info, type, project, project_prefix)
 | 
					    def parse_result(match_info, type, project, project_prefix)
 | 
				
			||||||
      prefix = match_info[:prefix]
 | 
					      prefix = match_info[:prefix]
 | 
				
			||||||
      suffix = match_info[:suffix]
 | 
					      suffix = match_info[:suffix]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return nil if html_entity?(prefix, suffix) || project.nil? || type.nil?
 | 
					      return nil if html_entity?(prefix, suffix) || type.nil?
 | 
				
			||||||
 | 
					      return nil if project.nil? && !project_prefix.nil?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      identifier = match_info[type]
 | 
					      identifier = match_info[type]
 | 
				
			||||||
      ref_link = reference_link(type, identifier, project, project_prefix)
 | 
					      ref_link = reference_link(type, identifier, project, project_prefix)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -51,7 +51,7 @@ module Gitlab
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private
 | 
					    private
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def reference_link(type, identifier, project)
 | 
					    def reference_link(type, identifier, _, _)
 | 
				
			||||||
      # Append identifier to the appropriate collection.
 | 
					      # Append identifier to the appropriate collection.
 | 
				
			||||||
      send("#{type}s") << identifier
 | 
					      send("#{type}s") << identifier
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue