Skip to content

Commit 8af9863

Browse files
author
Maksym Mykhailenko
committed
fix: invite by emails
when invite by emails only search for users with exact email we are inviting by
1 parent a7a2b56 commit 8af9863

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/routes/projectMemberInvites/create.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ const buildCreateInvitePromises = (req, inviteEmails, inviteUserIds, invites, da
105105
// if for some emails there are already existent users, we will invite them by userId,
106106
// to avoid sending them registration email
107107
return util.lookupMultipleUserEmails(req, inviteEmails, MAX_PARALLEL_REQUEST_QTY)
108+
// we have to filter emails returned by the Message Service so we only invite the users
109+
// whom we are inviting, because Message Service has a loose search logic and may return
110+
// users with emails whom we didn't search for
111+
.then(foundUsers => foundUsers.filter(foundUser => _.includes(inviteEmails, foundUser.email)))
108112
.then((existentUsers) => {
109113
// existent user we will invite by userId and email
110114
const existentUsersWithNumberId = existentUsers.map((user) => {

0 commit comments

Comments
 (0)