1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-06 07:31:31 +00:00

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
This commit is contained in:
Go MAEDA 2020-04-25 07:57:46 +00:00
parent 434f27a1ca
commit 9fdff6a552

View File

@ -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)