Index: app/controllers/watchers_controller.rb IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- app/controllers/watchers_controller.rb (revision dced4762005be491000490fc4c9661d0415272f7) +++ app/controllers/watchers_controller.rb (date 1540979006467) @@ -93,6 +93,8 @@ end elsif params[:project_id] @project = Project.visible.find_by_param(params[:project_id]) + elsif params[:project_ids] + @projects = Project.visible.where(:identifier => params[:project_ids]).to_a end end @@ -120,6 +122,9 @@ scope = nil if params[:q].blank? && @project.present? scope = @project.users + elsif @projects.present? + user_ids = @projects.map { |p| p.users.map(&:id) }.flatten.uniq + scope = User.where(:id => user_ids) else scope = User.all.limit(100) end Index: app/views/watchers/_new.html.erb IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- app/views/watchers/_new.html.erb (revision dced4762005be491000490fc4c9661d0415272f7) +++ app/views/watchers/_new.html.erb (date 1540979062942) @@ -12,13 +12,15 @@ <% end %> <% end %> <%= hidden_field_tag 'project_id', @project.id if @project %> + <%= hidden_field_tag 'project_ids', @projects if @projects %>

<%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %>

<%= javascript_tag "observeSearchfield('user_search', 'users_for_watcher', '#{ escape_javascript url_for(:controller => 'watchers', :action => 'autocomplete_for_user', :object_type => (watchables.present? ? watchables.first.class.name.underscore : nil), :object_id => (watchables.present? && watchables.size == 1 ? watchables.first.id : nil), - :project_id => @project) }')" %> + :project_id => @project, + :project_ids => @projects) }')" %>
<%= principals_check_box_tags('watcher[user_ids][]', users) %>