Refactor: extract error to new method with before_filter.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3690 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
23f097e344
commit
dfc448030d
|
@ -24,6 +24,7 @@ class IssuesController < ApplicationController
|
|||
before_filter :find_project, :only => [:new, :create, :update_form, :preview, :auto_complete]
|
||||
before_filter :authorize, :except => [:index, :changes, :gantt, :calendar, :preview, :context_menu]
|
||||
before_filter :find_optional_project, :only => [:index, :changes, :gantt, :calendar]
|
||||
before_filter :check_for_default_issue_status, :only => [:new, :create]
|
||||
before_filter :build_new_issue_from_params, :only => [:new, :create]
|
||||
accept_key_auth :index, :show, :changes
|
||||
|
||||
|
@ -557,10 +558,6 @@ private
|
|||
render_error l(:error_no_tracker_in_project)
|
||||
return false
|
||||
end
|
||||
if @issue.status.nil?
|
||||
render_error l(:error_no_default_issue_status)
|
||||
return false
|
||||
end
|
||||
if params[:issue].is_a?(Hash)
|
||||
@issue.safe_attributes = params[:issue]
|
||||
@issue.watcher_user_ids = params[:issue]['watcher_user_ids'] if User.current.allowed_to?(:add_issue_watchers, @project)
|
||||
|
@ -581,4 +578,11 @@ private
|
|||
:ids => '#' + unsaved_issue_ids.join(', #'))
|
||||
end
|
||||
end
|
||||
|
||||
def check_for_default_issue_status
|
||||
if IssueStatus.default.nil?
|
||||
render_error l(:error_no_default_issue_status)
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue