summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-10-26 22:33:33 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-10-26 22:33:33 +0000
commitf33dfe92436eb06b1e7f0d5a2ed28790b8d29c9d (patch)
tree7655dac9fce5e5d41e69581d3238a8825ef57910
parent05462a145f33e9e749033d8e6331e2146a037321 (diff)
downloadredmine-f33dfe92436eb06b1e7f0d5a2ed28790b8d29c9d.tar.gz
redmine-f33dfe92436eb06b1e7f0d5a2ed28790b8d29c9d.zip
Code cleanup.
git-svn-id: http://svn.redmine.org/redmine/trunk@13515 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/issue.rb25
1 files changed, 15 insertions, 10 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 31b2d69f1..21a6be587 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -779,25 +779,30 @@ class Issue < ActiveRecord::Base
initial_status = nil
if new_record?
initial_status = IssueStatus.default
- elsif status_id_was
- initial_status = IssueStatus.find_by_id(status_id_was)
+ else
+ initial_status = status_was
end
- initial_status ||= status
initial_assigned_to_id = assigned_to_id_changed? ? assigned_to_id_was : assigned_to_id
assignee_transitions_allowed = initial_assigned_to_id.present? &&
(user.id == initial_assigned_to_id || user.group_ids.include?(initial_assigned_to_id))
- statuses = initial_status.find_new_statuses_allowed_to(
- user.admin ? Role.all : user.roles_for_project(project),
- tracker,
- author == user,
- assignee_transitions_allowed
- )
+ statuses = []
+ if initial_status
+ statuses += initial_status.find_new_statuses_allowed_to(
+ user.admin ? Role.all.to_a : user.roles_for_project(project),
+ tracker,
+ author == user,
+ assignee_transitions_allowed
+ )
+ end
statuses << initial_status unless statuses.empty?
statuses << IssueStatus.default if include_default
statuses = statuses.compact.uniq.sort
- blocked? ? statuses.reject {|s| s.is_closed?} : statuses
+ if blocked?
+ statuses.reject!(&:is_closed?)
+ end
+ statuses
end
end