From 21e551369cefe1828fa178aec65904a72eb2510e Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 19 Dec 2015 08:02:31 +0000 Subject: [PATCH] Merged r14970 to r14972 (#21477). git-svn-id: http://svn.redmine.org/redmine/branches/3.1-stable@14981 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/issue.rb | 2 +- test/unit/issue_test.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index 7736877ce..2ad842877 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -783,7 +783,7 @@ class Issue < ActiveRecord::Base # Users the issue can be assigned to def assignable_users users = project.assignable_users.to_a - users << author if author + users << author if author && author.active? users << assigned_to if assigned_to users.uniq.sort end diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 9a8afd66d..8a901e9ec 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -1875,6 +1875,20 @@ class IssueTest < ActiveSupport::TestCase assert issue.assignable_users.include?(non_project_member) end + def test_assignable_users_should_not_include_anonymous_user + issue = Issue.generate!(:author => User.anonymous) + + assert !issue.assignable_users.include?(User.anonymous) + end + + def test_assignable_users_should_not_include_locked_user + user = User.generate! + issue = Issue.generate!(:author => user) + user.lock! + + assert !issue.assignable_users.include?(user) + end + test "#assignable_users should include the current assignee" do user = User.generate! issue = Issue.generate!(:assigned_to => user) -- 2.39.5