Skip to content

Commit f0fe7bf

Browse files
author
Maksym Mykhailenko
committed
fix: search invited user by email case-insensetive
1 parent 49d3756 commit f0fe7bf

File tree

1 file changed

+3
-3
lines changed
  • src/routes/projectMemberInvites

1 file changed

+3
-3
lines changed

src/routes/projectMemberInvites/list.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = [
2727
(req, res, next) => {
2828
const projectId = _.parseInt(req.params.projectId);
2929
const currentUserId = req.authUser.userId;
30-
const email = req.authUser.email;
30+
const currentUserEmail = req.authUser.email ? req.authUser.email.toLowerCase() : req.authUser.email;
3131
const fields = req.query.fields ? req.query.fields.split(',') : null;
3232

3333
const esSearchParam = {
@@ -64,7 +64,7 @@ module.exports = [
6464
esSearchParam.query.nested.query.filtered.filter.bool.must.push({
6565
bool: {
6666
should: [
67-
{ term: { 'invites.email': email } },
67+
{ term: { 'invites.email': currentUserEmail } },
6868
{ term: { 'invites.userId': currentUserId } },
6969
],
7070
minimum_number_should_match: 1,
@@ -90,7 +90,7 @@ module.exports = [
9090
}
9191
// get invitation only for user
9292
return models.ProjectMemberInvite.getPendingOrRequestedProjectInvitesForUser(
93-
projectId, email, currentUserId);
93+
projectId, currentUserEmail, currentUserId);
9494
}
9595
req.log.debug('project member found in ES');
9696
return data[0].inner_hits.invites.hits.hits.map(hit => hit._source); // eslint-disable-line no-underscore-dangle

0 commit comments

Comments
 (0)