diff options
author | Go MAEDA <maeda@farend.jp> | 2020-04-25 07:57:46 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2020-04-25 07:57:46 +0000 |
commit | 9fdff6a552430724936813bcb2e083037d6d81a7 (patch) | |
tree | b29b74512dd840572ddea42435eebcbe9e8c9486 | |
parent | 434f27a1ca377e1ca1885c033d361ce0e6c26aa1 (diff) | |
download | redmine-9fdff6a552430724936813bcb2e083037d6d81a7.tar.gz redmine-9fdff6a552430724936813bcb2e083037d6d81a7.zip |
Get the list of new issue watchers using single query and limit the results to 20 (#4511).
Patch by Marius BALTEANU.
git-svn-id: http://svn.redmine.org/redmine/trunk@19723 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/helpers/issues_helper.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 792c5a508..c43646174 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -365,13 +365,11 @@ module IssuesHelper # on the new issue form def users_for_new_issue_watchers(issue) users = issue.watcher_users.select{|u| u.status == User::STATUS_ACTIVE} - project = issue.project - scope_users = project.users - scope_groups = project.principals.merge(Group.givable) - if scope_users.count + scope_groups.count <= 20 - users = (users + scope_users.sort + scope_groups.sort).uniq + project_principals = issue.project.principals.where(:users => {:type => ['User', 'Group']}).limit(21) + if project_principals.size <= 20 + users += project_principals.sort end - users + users.uniq end def email_issue_attributes(issue, user, html) |