Groups added to watchers are not shown as links
After #4511 (v4.2.0), its possible to add Redmine groups as watchers on issues.
Users are shown as links, and groups are shown in Overview as links, and in Assignee field. However, gruops are shown as text when they are added to watchers
In the screenshot bellow, you can see 2 groups - 1 in assigne and 1 in watchers. You can see that user watcher is provided as link, while group is text
This behavior is not consistent and its harder for people involved to see group members (they must go to Overview page and search for that group there).
#1 Updated by Mizuki ISHIKAWA 4 days ago
I think the following code will solve the problem.
diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index fc97da1056..97067378e4 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -51,7 +51,7 @@ module WatchersHelper lis = object.watcher_users.collect do |user| s = ''.html_safe s << avatar(user, :size => "16").to_s - s << link_to_user(user, :class => 'user') + s << link_to_principal(user, class: user.class.to_s.downcase) if object.respond_to?(:visible?) && user.is_a?(User) && !object.visible?(user) s << content_tag('span', l(:notice_invalid_watcher), class: 'icon-only icon-warning', title: l(:notice_invalid_watcher)) end diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index a10abbd129..58e51348a9 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -2726,7 +2726,7 @@ class IssuesControllerTest < Redmine::ControllerTest end assert_select "li.user-10" do assert_select 'img.gravatar[title=?]', 'A Team' - assert_select 'a[href="/users/10"]', false + assert_select 'a[href="/groups/10"]' assert_select 'a[class*=delete]' end end
#2 Updated by Dmitry Makurin 4 days ago
Before r21073 only
link_to_(user/group) existed and it was clear what method was responsible for.
link_to_principal combined both
link_to_group and now it's really confusing what the difference between all of them.
I would suggest to unify
link_to_principal or properly decompose