Commit fc198c21 authored by jplang's avatar jplang

Makes all workflow transitions defined for all roles available to administrators (#2323).

git-svn-id: https://svn.redmine.org/redmine/trunk@8707 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent fdb40262
......@@ -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
......
......@@ -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?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment