[refs #90] remove unneeded method

This commit is contained in:
Alexander Machehin 2012-08-08 00:17:10 +06:00
parent 5cb1f4e7e9
commit edf882f2a1
2 changed files with 2 additions and 6 deletions

View File

@ -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])

View File

@ -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)