mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-30 19:52:20 +01:00
Fix a bug: admins are shown in select member for reservation by admin
This commit is contained in:
parent
b07b329067
commit
ef5d603065
@ -2,6 +2,8 @@
|
||||
|
||||
## next deploy
|
||||
|
||||
- Fix a bug: admins are shown in select member for reservation by admin
|
||||
|
||||
## v5.4.2 2022 June 1
|
||||
|
||||
- Updated react-select to 5.3.2
|
||||
|
@ -180,7 +180,7 @@ class API::MembersController < API::ApiController
|
||||
end
|
||||
|
||||
def search
|
||||
@members = Members::ListService.search(current_user, params[:query], params[:subscription])
|
||||
@members = Members::ListService.search(current_user, params[:query], params[:subscription], params[:project])
|
||||
end
|
||||
|
||||
def mapping
|
||||
|
@ -231,7 +231,7 @@ class ProjectsController {
|
||||
const asciiName = Diacritics.remove(nameLookup);
|
||||
|
||||
Member.search(
|
||||
{ query: asciiName },
|
||||
{ query: asciiName, project: 'true' },
|
||||
function (users) { $scope.matchingMembers = users; },
|
||||
function (error) { console.error(error); }
|
||||
);
|
||||
|
@ -40,7 +40,7 @@ class Members::ListService
|
||||
@query
|
||||
end
|
||||
|
||||
def search(current_user, query, subscription)
|
||||
def search(current_user, query, subscription, project)
|
||||
members = User.includes(:profile)
|
||||
.joins(:profile,
|
||||
:statistic_profile,
|
||||
@ -69,6 +69,10 @@ class Members::ListService
|
||||
members = members.where('subscriptions.id IS NULL OR subscriptions.expiration_date < :now', now: Date.today.to_s)
|
||||
end
|
||||
|
||||
if project == 'false' || project.blank?
|
||||
members = members.where("roles.name = 'member' OR roles.name = 'manager'")
|
||||
end
|
||||
|
||||
members.to_a
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user