mirror of
https://github.com/redmine/redmine.git
synced 2025-11-11 15:56:03 +01:00
Fixed that improper statuses are proposed when changing status before tracker on the issue form (#10619).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9378 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -509,17 +509,25 @@ class Issue < ActiveRecord::Base
|
||||
!relations_to.detect {|ir| ir.relation_type == 'blocks' && !ir.issue_from.closed?}.nil?
|
||||
end
|
||||
|
||||
# Returns an array of status that user is able to apply
|
||||
# Returns an array of statuses that user is able to apply
|
||||
def new_statuses_allowed_to(user=User.current, include_default=false)
|
||||
statuses = status.find_new_statuses_allowed_to(
|
||||
initial_status = nil
|
||||
if new_record?
|
||||
initial_status = IssueStatus.default
|
||||
elsif status_id_was
|
||||
initial_status = IssueStatus.find_by_id(status_id_was)
|
||||
end
|
||||
initial_status ||= status
|
||||
|
||||
statuses = initial_status.find_new_statuses_allowed_to(
|
||||
user.admin ? Role.all : user.roles_for_project(project),
|
||||
tracker,
|
||||
author == user,
|
||||
assigned_to_id_changed? ? assigned_to_id_was == user.id : assigned_to_id == user.id
|
||||
)
|
||||
statuses << status unless statuses.empty?
|
||||
statuses << initial_status unless statuses.empty?
|
||||
statuses << IssueStatus.default if include_default
|
||||
statuses = statuses.uniq.sort
|
||||
statuses = statuses.compact.uniq.sort
|
||||
blocked? ? statuses.reject {|s| s.is_closed?} : statuses
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user