summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-02 19:45:14 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-02 19:45:14 +0000
commitdfc594c33702a123674dcae1d6b4bfe3a2f32fd3 (patch)
tree42f8653451b35f54db68bf914e1d963bfaf13418 /app/controllers
parent32b79b6fd4e3a523ee393d7a3e2bb60dbeed77c3 (diff)
downloadredmine-dfc594c33702a123674dcae1d6b4bfe3a2f32fd3.tar.gz
redmine-dfc594c33702a123674dcae1d6b4bfe3a2f32fd3.zip
Default status per tracker (#5991).
git-svn-id: http://svn.redmine.org/redmine/trunk@13535 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/issues_controller.rb22
1 files changed, 12 insertions, 10 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 200d8b112..78f7c27ea 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -24,7 +24,6 @@ class IssuesController < ApplicationController
before_filter :find_project, :only => [:new, :create, :update_form]
before_filter :authorize, :except => [:index]
before_filter :find_optional_project, :only => [:index]
- before_filter :check_for_default_issue_status, :only => [:new, :create]
before_filter :build_new_issue_from_params, :only => [:new, :create, :update_form]
accept_rss_auth :index, :show
accept_api_auth :index, :show, :create, :update, :destroy
@@ -234,7 +233,8 @@ class IssuesController < ApplicationController
target_projects ||= @projects
if @copy
- @available_statuses = [IssueStatus.default]
+ # Copied issues will get their default statuses
+ @available_statuses = []
else
@available_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&)
end
@@ -425,12 +425,21 @@ class IssuesController < ApplicationController
@issue = @project.issues.visible.find(params[:id])
end
- @issue.safe_attributes = params[:issue]
+ if attrs = params[:issue].deep_dup
+ if params[:was_default_status] == attrs[:status_id]
+ attrs.delete(:status_id)
+ end
+ @issue.safe_attributes = attrs
+ end
@issue.tracker ||= @project.trackers.first
if @issue.tracker.nil?
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
@priorities = IssuePriority.active
@allowed_statuses = @issue.new_statuses_allowed_to(User.current, @issue.new_record?)
@@ -440,13 +449,6 @@ class IssuesController < ApplicationController
end
end
- def check_for_default_issue_status
- if IssueStatus.default.nil?
- render_error l(:error_no_default_issue_status)
- return false
- end
- end
-
def parse_params_for_bulk_issue_attributes(params)
attributes = (params[:issue] || {}).reject {|k,v| v.blank?}
attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'}