1
0
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:
Du Peng 2022-06-03 12:05:23 +02:00
parent b07b329067
commit ef5d603065
4 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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); }
);

View File

@ -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