##// END OF EJS Templates
Makes all workflow transitions defined for all roles available to administrators (#2323)....
Jean-Philippe Lang -
r8587:ffbd3c0522a0
parent child
Show More
@@ -503,7 +503,7 class Issue < ActiveRecord::Base
503 # Returns an array of status that user is able to apply
503 # Returns an array of status that user is able to apply
504 def new_statuses_allowed_to(user, include_default=false)
504 def new_statuses_allowed_to(user, include_default=false)
505 statuses = status.find_new_statuses_allowed_to(
505 statuses = status.find_new_statuses_allowed_to(
506 user.roles_for_project(project),
506 user.admin ? Role.all : user.roles_for_project(project),
507 tracker,
507 tracker,
508 author == user,
508 author == user,
509 assigned_to_id_changed? ? assigned_to_id_was == user.id : assigned_to_id == user.id
509 assigned_to_id_changed? ? assigned_to_id_was == user.id : assigned_to_id == user.id
@@ -387,6 +387,15 class IssueTest < ActiveSupport::TestCase
387 assert_equal [1, 2, 3, 4, 5], issue.new_statuses_allowed_to(user).map(&:id)
387 assert_equal [1, 2, 3, 4, 5], issue.new_statuses_allowed_to(user).map(&:id)
388 end
388 end
389
389
390 def test_new_statuses_allowed_to_should_return_all_transitions_for_admin
391 admin = User.find(1)
392 issue = Issue.find(1)
393 assert !admin.member_of?(issue.project)
394 expected_statuses = [issue.status] + Workflow.find_all_by_old_status_id(issue.status_id).map(&:new_status).uniq.sort
395
396 assert_equal expected_statuses, issue.new_statuses_allowed_to(admin)
397 end
398
390 def test_copy
399 def test_copy
391 issue = Issue.new.copy_from(1)
400 issue = Issue.new.copy_from(1)
392 assert issue.copy?
401 assert issue.copy?
General Comments 0
You need to be logged in to leave comments. Login now