Browse Source
			
			
			Merge pull request #22854 from nextcloud/bugfix/noid/unified-search
			
				Bugfix/noid/unified search
			
			
				pull/22860/head
			
			
		 
		
			
				
					
						 Roeland Jago Douma
					
					5 years ago
						Roeland Jago Douma
					
					5 years ago
					
						
							committed by
							
								 GitHub
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
				  
				  No known key found for this signature in database
				  
				  	
						GPG Key ID: 4AEE18F83AFDEB23
				  	
				  
				
			
		
		
		
	
		
			
				 3 changed files with 
9 additions and 
8 deletions
			 
			
		 
		
			
				- 
					
					
					 
					apps/comments/lib/Search/CommentsSearchProvider.php
				
- 
					
					
					 
					apps/files/lib/Search/FilesSearchProvider.php
				
- 
					
					
					 
					core/Controller/UnifiedSearchController.php
				
					
					
						
							
								
									
										
											
	
		
			
				
					|  |  | @ -99,13 +99,13 @@ class CommentsSearchProvider implements IProvider { | 
			
		
	
		
			
				
					|  |  |  | 				$pathInfo = pathinfo($path); | 
			
		
	
		
			
				
					|  |  |  | 				$isUser = $this->userManager->userExists($result->authorId); | 
			
		
	
		
			
				
					|  |  |  | 				$avatarUrl = $isUser | 
			
		
	
		
			
				
					|  |  |  | 					? $this->urlGenerator->linkToRoute('core.avatar.getAvatar', ['userId' => $result->authorId, 'size' => 42]) | 
			
		
	
		
			
				
					|  |  |  | 					: $this->urlGenerator->linkToRoute('core.GuestAvatar.getAvatar', ['guestName' => $result->authorId, 'size' => 42]); | 
			
		
	
		
			
				
					|  |  |  | 					? $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => $result->authorId, 'size' => 42]) | 
			
		
	
		
			
				
					|  |  |  | 					: $this->urlGenerator->linkToRouteAbsolute('core.GuestAvatar.getAvatar', ['guestName' => $result->authorId, 'size' => 42]); | 
			
		
	
		
			
				
					|  |  |  | 				return new SearchResultEntry( | 
			
		
	
		
			
				
					|  |  |  | 					$avatarUrl, | 
			
		
	
		
			
				
					|  |  |  | 					$result->name, | 
			
		
	
		
			
				
					|  |  |  | 					$path, | 
			
		
	
		
			
				
					|  |  |  | 					$this->urlGenerator->linkToRoute('files.view.index',[ | 
			
		
	
		
			
				
					|  |  |  | 					$this->urlGenerator->linkToRouteAbsolute('files.view.index',[ | 
			
		
	
		
			
				
					|  |  |  | 						'dir' => $pathInfo['dirname'], | 
			
		
	
		
			
				
					|  |  |  | 						'scrollto' => $pathInfo['basename'], | 
			
		
	
		
			
				
					|  |  |  | 					]), | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
										
									
								
							
						 
					 
				 
			
		
			
				
					
					
						
							
								
									
										
											
	
		
			
				
					|  |  | @ -107,14 +107,14 @@ class FilesSearchProvider implements IProvider { | 
			
		
	
		
			
				
					|  |  |  | 			array_map(function (FileResult $result) { | 
			
		
	
		
			
				
					|  |  |  | 				// Generate thumbnail url
 | 
			
		
	
		
			
				
					|  |  |  | 				$thumbnailUrl = $result->has_preview | 
			
		
	
		
			
				
					|  |  |  | 					? $this->urlGenerator->linkToRoute('core.Preview.getPreviewByFileId', ['x' => 32, 'y' => 32, 'fileId' => $result->id]) | 
			
		
	
		
			
				
					|  |  |  | 					? $this->urlGenerator->linkToRouteAbsolute('core.Preview.getPreviewByFileId', ['x' => 32, 'y' => 32, 'fileId' => $result->id]) | 
			
		
	
		
			
				
					|  |  |  | 					: ''; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 				return new SearchResultEntry( | 
			
		
	
		
			
				
					|  |  |  | 					$thumbnailUrl, | 
			
		
	
		
			
				
					|  |  |  | 					$result->name, | 
			
		
	
		
			
				
					|  |  |  | 					$this->formatSubline($result), | 
			
		
	
		
			
				
					|  |  |  | 					$result->link, | 
			
		
	
		
			
				
					|  |  |  | 					$this->urlGenerator->getAbsoluteURL($result->link), | 
			
		
	
		
			
				
					|  |  |  | 					$result->type === 'folder' ? 'icon-folder' : $this->mimeTypeDetector->mimeTypeIcon($result->mime_type) | 
			
		
	
		
			
				
					|  |  |  | 				); | 
			
		
	
		
			
				
					|  |  |  | 			}, $this->fileSearch->search($query->getTerm())) | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
										
									
								
							
						 
					 
				 
			
		
			
				
					
					
						
							
								
									
										
											
	
		
			
				
					|  |  | @ -72,9 +72,10 @@ class UnifiedSearchController extends OCSController { | 
			
		
	
		
			
				
					|  |  |  | 	public function getProviders(string $from = ''): DataResponse { | 
			
		
	
		
			
				
					|  |  |  | 		[$route, $parameters] = $this->getRouteInformation($from); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		return new DataResponse( | 
			
		
	
		
			
				
					|  |  |  | 			$this->composer->getProviders($route, $parameters) | 
			
		
	
		
			
				
					|  |  |  | 		); | 
			
		
	
		
			
				
					|  |  |  | 		$result = $this->composer->getProviders($route, $parameters); | 
			
		
	
		
			
				
					|  |  |  | 		$response = new DataResponse($result); | 
			
		
	
		
			
				
					|  |  |  | 		$response->setETag(md5(json_encode($result))); | 
			
		
	
		
			
				
					|  |  |  | 		return $response; | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	/** | 
			
		
	
	
		
			
				
					|  |  | 
 |