summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2022-02-01 20:11:56 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2022-02-01 20:11:56 +0000
commitd2f64ee9288a3be2ec29e42aaf796559d3dd6b4b (patch)
tree083a1f624dd202ab2d70cea2e7b0e7a003d5a8fd /app/controllers
parent5ea0340b8d93062e3687c896ed8f79d72b3c2f2b (diff)
downloadredmine-d2f64ee9288a3be2ec29e42aaf796559d3dd6b4b.tar.gz
redmine-d2f64ee9288a3be2ec29e42aaf796559d3dd6b4b.zip
Fix autocomplete for users fails with 403 error when there are multiple objects from different projects (#36446).
Patch by Dmitry Makurin. git-svn-id: http://svn.redmine.org/redmine/trunk@21394 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/watchers_controller.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb
index 97afffe01..9170acb34 100644
--- a/app/controllers/watchers_controller.rb
+++ b/app/controllers/watchers_controller.rb
@@ -134,8 +134,12 @@ class WatchersController < ApplicationController
def users_for_new_watcher
scope = nil
- if params[:q].blank? && @project.present?
- scope = @project.principals.assignable_watchers
+ if params[:q].blank?
+ if @project.present?
+ scope = @project.principals.assignable_watchers
+ elsif @projects.present? && @projects.size > 1
+ scope = Principal.joins(:members).where(:members => { :project_id => @projects }).assignable_watchers.distinct
+ end
else
scope = Principal.assignable_watchers.limit(100)
end