Makes all workflow transitions defined for all roles available to administrators (#2323).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8707 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
30579e6619
commit
ffbd3c0522
@ -503,7 +503,7 @@ class Issue < ActiveRecord::Base
|
|||||||
# Returns an array of status that user is able to apply
|
# Returns an array of status that user is able to apply
|
||||||
def new_statuses_allowed_to(user, include_default=false)
|
def new_statuses_allowed_to(user, include_default=false)
|
||||||
statuses = status.find_new_statuses_allowed_to(
|
statuses = status.find_new_statuses_allowed_to(
|
||||||
user.roles_for_project(project),
|
user.admin ? Role.all : user.roles_for_project(project),
|
||||||
tracker,
|
tracker,
|
||||||
author == user,
|
author == user,
|
||||||
assigned_to_id_changed? ? assigned_to_id_was == user.id : assigned_to_id == user.id
|
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)
|
assert_equal [1, 2, 3, 4, 5], issue.new_statuses_allowed_to(user).map(&:id)
|
||||||
end
|
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
|
def test_copy
|
||||||
issue = Issue.new.copy_from(1)
|
issue = Issue.new.copy_from(1)
|
||||||
assert issue.copy?
|
assert issue.copy?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user