diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-08-03 16:23:43 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-08-03 16:23:43 +0300 |
commit | ef6ce7a9ec465687df47beab86ac3cb06f6f3898 (patch) | |
tree | 4e95ccf02c4cb78c27410fcfd694d03e9048dbc7 /app/controllers | |
parent | f711b2df8bf02ed10716cdd6292002132413e3d8 (diff) |
More backend cleanup
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects_controller.rb | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index bf038ffa2a2..ce0938ffe99 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -227,29 +227,27 @@ class ProjectsController < Projects::ApplicationController find_commits = true unless find_refs.nil? - find_branches = find_refs.include? 'branches' - find_tags = find_refs.include? 'tags' - find_commits = find_refs.include? 'commits' + find_branches = find_refs.include?('branches') + find_tags = find_refs.include?('tags') + find_commits = find_refs.include?('commits') end options = {} if find_branches - branches = BranchesFinder.new(@repository, params).execute.map(&:name) - options = { - s_('RefSwitcher|Branches') => branches.take(100) - } + branches = BranchesFinder.new(@repository, params).execute.take(100).map(&:name) + options[s_('RefSwitcher|Branches')] = branches end - if @repository.tag_count.nonzero? && find_tags - tags = TagsFinder.new(@repository, params).execute.map(&:name) + if find_tags && @repository.tag_count.nonzero? + tags = TagsFinder.new(@repository, params).execute.take(100).map(&:name) - options[s_('RefSwitcher|Tags')] = tags.take(100) + options[s_('RefSwitcher|Tags')] = tags end # If reference is commit id - we should add it to branch/tag selectbox ref = Addressable::URI.unescape(params[:ref]) - if ref && options.flatten(2).exclude?(ref) && ref =~ /\A[0-9a-zA-Z]{6,52}\z/ && find_commits + if find_commits && ref && options.flatten(2).exclude?(ref) && ref =~ /\A[0-9a-zA-Z]{6,52}\z/ options['Commits'] = [ref] end |