[#refs #90] fix pull flashes

This commit is contained in:
Alexander Machehin 2012-09-28 23:45:27 +06:00
parent e7549635f0
commit 90069b2fb6
1 changed files with 7 additions and 7 deletions

View File

@ -16,12 +16,12 @@ class Projects::PullRequestsController < Projects::BaseController
set_attrs set_attrs
if PullRequest.check_ref(@pull, 'base', @pull.base_ref) && PullRequest.check_ref(@pull, 'head', @pull.head_ref) || @pull.uniq_merge if PullRequest.check_ref(@pull, 'base', @pull.base_ref) && PullRequest.check_ref(@pull, 'head', @pull.head_ref) || @pull.uniq_merge
flash[:warning] = @pull.errors.full_messages.join('. ') flash.now[:warning] = @pull.errors.full_messages.join('. ')
else else
@pull.check(false) # don't make event transaction @pull.check(false) # don't make event transaction
if @pull.already? if @pull.already?
@pull.destroy @pull.destroy
flash[:warning] = I18n.t('projects.pull_requests.up_to_date', :base_ref => @pull.base_ref, :head_ref => @pull.head_ref) flash.now[:warning] = I18n.t('projects.pull_requests.up_to_date', :base_ref => @pull.base_ref, :head_ref => @pull.head_ref)
else else
load_diff_commits_data load_diff_commits_data
end end
@ -44,15 +44,15 @@ class Projects::PullRequestsController < Projects::BaseController
@pull.check(false) # don't make event transaction @pull.check(false) # don't make event transaction
if @pull.already? if @pull.already?
@pull.destroy @pull.destroy
flash[:error] = I18n.t('projects.pull_requests.up_to_date', :base_ref => @pull.base_ref, :head_ref => @pull.head_ref) flash.now[:error] = I18n.t('projects.pull_requests.up_to_date', :base_ref => @pull.base_ref, :head_ref => @pull.head_ref)
render :new render :new
else else
@pull.check @pull.check
redirect_to project_pull_request_path(@pull.base_project, @pull) redirect_to project_pull_request_path(@pull.base_project, @pull)
end end
else else
flash[:error] = t('flash.pull_request.save_error') flash.now[:error] = t('flash.pull_request.save_error')
flash[:warning] = @pull.errors.full_messages.join('. ') flash.now[:warning] = @pull.errors.full_messages.join('. ')
if @pull.errors.try(:messages) && @pull.errors.messages[:base_ref].nil? && @pull.errors.messages[:head_ref].nil? if @pull.errors.try(:messages) && @pull.errors.messages[:base_ref].nil? && @pull.errors.messages[:head_ref].nil?
@pull.check(false) # don't make event transaction @pull.check(false) # don't make event transaction
@ -78,8 +78,8 @@ class Projects::PullRequestsController < Projects::BaseController
def merge def merge
@pull.check @pull.check
unless @pull.merge!(current_user) unless @pull.merge!(current_user)
flash[:error] = t('flash.pull_request.save_error') flash.now[:error] = t('flash.pull_request.save_error')
flash[:warning] = @pull.errors.full_messages.join('. ') flash.now[:warning] = @pull.errors.full_messages.join('. ')
end end
redirect_to project_pull_request_path(@pull.base_project, @pull) redirect_to project_pull_request_path(@pull.base_project, @pull)
end end