diff options
author | Vinnie Okada <vokada@mrvinn.com> | 2015-03-21 18:03:35 +0300 |
---|---|---|
committer | Vinnie Okada <vokada@mrvinn.com> | 2015-03-21 18:03:35 +0300 |
commit | f5e65e2e508269ff7c18318526ba01f8e7d83951 (patch) | |
tree | dd834b066dc51de87139d69ea042e0bdfd69334d /app/controllers/search_controller.rb | |
parent | cc29ce491786d631586c3b0d0da310b8b790a673 (diff) | |
parent | 6cf189f0a92772b9174f913e7c74a4889d54e9a6 (diff) |
Merge branch 'master' into markdown-tags
Merge updated CHANGELOG entries
Diffstat (limited to 'app/controllers/search_controller.rb')
-rw-r--r-- | app/controllers/search_controller.rb | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 55926a1ed22..a3284c82d3f 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -2,34 +2,34 @@ class SearchController < ApplicationController include SearchHelper def show + return if params[:search].nil? || params[:search].blank? @project = Project.find_by(id: params[:project_id]) if params[:project_id].present? @group = Group.find_by(id: params[:group_id]) if params[:group_id].present? @scope = params[:scope] @show_snippets = params[:snippets].eql? 'true' - @search_results = if @project - return access_denied! unless can?(current_user, :download_code, @project) - - unless %w(blobs notes issues merge_requests wiki_blobs). - include?(@scope) - @scope = 'blobs' - end - - Search::ProjectService.new(@project, current_user, params).execute - elsif @show_snippets - unless %w(snippet_blobs snippet_titles).include?(@scope) - @scope = 'snippet_blobs' - end - - Search::SnippetService.new(current_user, params).execute - else - unless %w(projects issues merge_requests).include?(@scope) - @scope = 'projects' - end - - Search::GlobalService.new(current_user, params).execute - end - + @search_results = + if @project + return access_denied! unless can?(current_user, :download_code, @project) + + unless %w(blobs notes issues merge_requests wiki_blobs). + include?(@scope) + @scope = 'blobs' + end + + Search::ProjectService.new(@project, current_user, params).execute + elsif @show_snippets + unless %w(snippet_blobs snippet_titles).include?(@scope) + @scope = 'snippet_blobs' + end + + Search::SnippetService.new(current_user, params).execute + else + unless %w(projects issues merge_requests).include?(@scope) + @scope = 'projects' + end + Search::GlobalService.new(current_user, params).execute + end @objects = @search_results.objects(@scope, params[:page]) end |