diff --git a/app/models/issue.rb b/app/models/issue.rb index 2b9b12b77..d20cff35d 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -503,7 +503,7 @@ class Issue < ActiveRecord::Base # Returns an array of status that user is able to apply def new_statuses_allowed_to(user, include_default=false) statuses = status.find_new_statuses_allowed_to( - user.roles_for_project(project), + 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 diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index ee56ffe74..b4ba86e49 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -387,6 +387,15 @@ class IssueTest < ActiveSupport::TestCase assert_equal [1, 2, 3, 4, 5], issue.new_statuses_allowed_to(user).map(&:id) end + def test_new_statuses_allowed_to_should_return_all_transitions_for_admin + admin = User.find(1) + issue = Issue.find(1) + assert !admin.member_of?(issue.project) + expected_statuses = [issue.status] + Workflow.find_all_by_old_status_id(issue.status_id).map(&:new_status).uniq.sort + + assert_equal expected_statuses, issue.new_statuses_allowed_to(admin) + end + def test_copy issue = Issue.new.copy_from(1) assert issue.copy?