From edf882f2a1007e2008a3730090b9d9d7affedd11 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Wed, 8 Aug 2012 00:17:10 +0600 Subject: [PATCH] [refs #90] remove unneeded method --- app/controllers/projects/pull_requests_controller.rb | 4 ++-- app/models/pull_request.rb | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/controllers/projects/pull_requests_controller.rb b/app/controllers/projects/pull_requests_controller.rb index 3cedfc19f..21ecd6c44 100644 --- a/app/controllers/projects/pull_requests_controller.rb +++ b/app/controllers/projects/pull_requests_controller.rb @@ -8,7 +8,7 @@ class Projects::PullRequestsController < Projects::BaseController before_filter :load_pull, :except => :autocomplete_base_project def new - base_project = (Project.find(params[:base_project_id]) if params[:base_project_id]) || PullRequest.default_base_project(@project) + base_project = (Project.find(params[:base_project_id]) if params[:base_project_id]) || @project.root authorize! :read, base_project @pull = base_project.pull_requests.new @@ -91,7 +91,7 @@ class Projects::PullRequestsController < Projects::BaseController def autocomplete_base_project #Maybe slow? ILIKE? items = Project.accessible_by(current_ability, :membered) - items << PullRequest.default_base_project(@project) + items << @project.root items.select! {|e| Regexp.new(params[:term].downcase).match(e.name.downcase) && e.repo.branches.count > 0} items.uniq! render :json => json_for_autocomplete_base(items)#, :fullname, [:branches]) diff --git a/app/models/pull_request.rb b/app/models/pull_request.rb index 07bcd4b65..8259a2590 100644 --- a/app/models/pull_request.rb +++ b/app/models/pull_request.rb @@ -87,10 +87,6 @@ class PullRequest < ActiveRecord::Base end end - def self.default_base_project(project) - project.is_root? ? project : project.root - end - def path filename = [id, head_project.owner.uname, head_project.name].compact.join('-') File.join(APP_CONFIG['root_path'], 'pull_requests', base_project.owner.uname, base_project.name, filename)