Patch #29885 » fix_403_cm_new_watchers.patch
| app/controllers/watchers_controller.rb (date 1540979006467) | ||
|---|---|---|
|
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
|
||
|
|
||
| ... | ... | |
|
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
|
||
| app/views/watchers/_new.html.erb (date 1540979062942) | ||
|---|---|---|
|
<% end %>
|
||
|
<% end %>
|
||
|
<%= hidden_field_tag 'project_id', @project.id if @project %>
|
||
|
<%= hidden_field_tag 'project_ids', @projects if @projects %>
|
||
|
|
||
|
<p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p>
|
||
|
<%= 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) }')" %>
|
||
|
|
||
|
<div id="users_for_watcher">
|
||
|
<%= principals_check_box_tags('watcher[user_ids][]', users) %>
|
||