mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-19 14:01:03 +08:00
Merge pull request #7572 from rekonder/aj_SCI_10723
Add global search filtering ability by assigned users [SCI-10723]
This commit is contained in:
commit
d49bf05299
1 changed files with 7 additions and 1 deletions
|
@ -247,6 +247,12 @@ class SearchController < ApplicationController
|
|||
def filter_users!(model)
|
||||
@records = @records.joins("INNER JOIN activities ON #{model.model_name.collection}.id = activities.subject_id
|
||||
AND activities.subject_type= '#{model.name}'")
|
||||
.where('activities.owner_id': @filters[:users]&.values)
|
||||
|
||||
user_ids = @filters[:users]&.values
|
||||
@records = if model.name == 'MyModule'
|
||||
@records.where('activities.owner_id IN (?) OR users.id IN (?)', user_ids, user_ids)
|
||||
else
|
||||
@records.where('activities.owner_id': user_ids)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue