]> source.dussan.org Git - redmine.git/commitdiff
Moved users list diplayed as available watchers on the new issue form to an helper.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 13 Feb 2015 17:32:26 +0000 (17:32 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 13 Feb 2015 17:32:26 +0000 (17:32 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@13995 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/issues_controller.rb
app/helpers/issues_helper.rb
app/views/issues/new.html.erb

index b95856a19d28f237e55a77870a6423adf22c1b44..13de1661a320c508ada31bec39d4f541750a3295 100644 (file)
@@ -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)
index 82b8905e247c5d6273d94106ac792d34c8c3076b..885b1c5b134158d04d1b84c03cdef256b3f78c06 100644 (file)
@@ -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.
index 206df8d18a95fd7d74e474e0406b6c962ee36fba..f168c39a46b8b63986e6ce5ce8dda69b2ea5ea40 100644 (file)
@@ -35,7 +35,7 @@
     <% if @issue.safe_attribute? 'watcher_user_ids' -%>
       <p id="watchers_form"><label><%= l(:label_issue_watchers) %></label>
       <span id="watchers_inputs">
-        <%= watchers_checkboxes(@issue, @available_watchers) %>
+        <%= watchers_checkboxes(@issue, users_for_new_issue_watchers(@issue)) %>
       </span>
       <span class="search_for_watchers">
       <%= link_to l(:label_search_for_watchers),