summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-02-06 08:19:13 +0000
committerGo MAEDA <maeda@farend.jp>2020-02-06 08:19:13 +0000
commitb995014c495b36102f36ec80618f50f3763bcd6f (patch)
tree85c230cf16c300f51f9716299ff7bc48d300c4cf /app/helpers
parent29433771b45319a0b50f182f0dcaf72db1275a30 (diff)
downloadredmine-b995014c495b36102f36ec80618f50f3763bcd6f.tar.gz
redmine-b995014c495b36102f36ec80618f50f3763bcd6f.zip
Allow adding user groups as watchers for issues (#4511).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@19498 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/avatars_helper.rb6
-rw-r--r--app/helpers/issues_helper.rb7
-rw-r--r--app/helpers/watchers_helper.rb2
3 files changed, 12 insertions, 3 deletions
diff --git a/app/helpers/avatars_helper.rb b/app/helpers/avatars_helper.rb
index 7e2a1fffd..49be006a8 100644
--- a/app/helpers/avatars_helper.rb
+++ b/app/helpers/avatars_helper.rb
@@ -51,6 +51,8 @@ module AvatarsHelper
gravatar(email.to_s.downcase, options) rescue nil
elsif user.is_a?(AnonymousUser)
anonymous_avatar(options)
+ elsif user.is_a?(Group)
+ group_avatar(options)
else
nil
end
@@ -72,4 +74,8 @@ module AvatarsHelper
def anonymous_avatar(options={})
image_tag 'anonymous.png', GravatarHelper::DEFAULT_OPTIONS.except(:default, :rating, :ssl).merge(options)
end
+
+ def group_avatar(options={})
+ image_tag 'group.png', GravatarHelper::DEFAULT_OPTIONS.except(:default, :rating, :ssl).merge(options)
+ end
end
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 2ea81d566..0f327b77e 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -365,8 +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}
- if issue.project.users.count <= 20
- users = (users + issue.project.users.sort).uniq
+ 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
end
users
end
diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb
index dab5e6b76..ac732c339 100644
--- a/app/helpers/watchers_helper.rb
+++ b/app/helpers/watchers_helper.rb
@@ -47,7 +47,7 @@ module WatchersHelper
def watchers_list(object)
remove_allowed = User.current.allowed_to?("delete_#{object.class.name.underscore}_watchers".to_sym, object.project)
content = ''.html_safe
- lis = object.watcher_users.preload(:email_address).collect do |user|
+ lis = object.watcher_users.collect do |user|
s = ''.html_safe
s << avatar(user, :size => "16").to_s
s << link_to_user(user, :class => 'user')