From 82d4b03cf68271d6168c4b3b39432e6ab186dedb Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Mon, 7 Nov 2022 21:56:38 +0100 Subject: [PATCH] Fix global activities user selection dropdown [SCI-7402] --- app/models/user.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 8bc5c1446..6e82b609f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -403,7 +403,7 @@ class User < ApplicationRecord result = result.where.not(confirmed_at: nil) if active_only if team_to_ignore.present? - ignored_ids = UserTeam.select(:user_id).where(team_id: team_to_ignore.id) + ignored_ids = UserAssignment.select(:user_id).where(assignable: team_to_ignore) result = result.where.not(users: { id: ignored_ids }) end @@ -629,7 +629,7 @@ class User < ApplicationRecord query_teams = teams.pluck(:id) query_teams &= filters[:teams].map(&:to_i) if filters[:teams] query_teams &= User.team_by_subject(filters[:subjects]) if filters[:subjects] - User.where(id: UserTeam.where(team_id: query_teams).select(:user_id)) + User.where(id: UserAssignment.where(assignable_id: query_teams, assignable_type: 'Team').select(:user_id)) .search(false, search_query) .select(:full_name, :id) .map { |i| { label: escape_input(i[:full_name]), value: i[:id] } }