From: Jean-Philippe Lang Date: Fri, 13 Feb 2015 17:32:26 +0000 (+0000) Subject: Moved users list diplayed as available watchers on the new issue form to an helper. X-Git-Tag: 3.0.0~31 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9548d39a15c15338c790f18cdced3b17029af282;p=redmine.git Moved users list diplayed as available watchers on the new issue form to an helper. git-svn-id: http://svn.redmine.org/redmine/trunk@13995 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index b95856a19..13de1661a 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -466,10 +466,6 @@ class IssuesController < ApplicationController @priorities = IssuePriority.active @allowed_statuses = @issue.new_statuses_allowed_to(User.current, @issue.new_record?) - @available_watchers = @issue.watcher_users - if @issue.project.users.count <= 20 - @available_watchers = (@available_watchers + @issue.project.users.sort).uniq - end end def parse_params_for_bulk_issue_attributes(params) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 82b8905e2..885b1c5b1 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -217,6 +217,16 @@ module IssuesHelper message end + # Returns an array of users that are proposed as watchers + # on the new issue form + def users_for_new_issue_watchers(issue) + users = issue.watcher_users + if issue.project.users.count <= 20 + users = (users + issue.project.users.sort).uniq + end + users + end + def sidebar_queries unless @sidebar_queries @sidebar_queries = IssueQuery.visible. diff --git a/app/views/issues/new.html.erb b/app/views/issues/new.html.erb index 206df8d18..f168c39a4 100644 --- a/app/views/issues/new.html.erb +++ b/app/views/issues/new.html.erb @@ -35,7 +35,7 @@ <% if @issue.safe_attribute? 'watcher_user_ids' -%>

- <%= watchers_checkboxes(@issue, @available_watchers) %> + <%= watchers_checkboxes(@issue, users_for_new_issue_watchers(@issue)) %> <%= link_to l(:label_search_for_watchers),