Skip to content

Commit 13f5dfd

Browse files
committed
update invite change
1 parent 0c1ce34 commit 13f5dfd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/models/projectMemberInvite.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ module.exports = function defineProjectMemberInvite(sequelize, DataTypes) {
5858
getPendingInviteByEmailOrUserId(projectId, email, userId) {
5959
const where = { status: INVITE_STATUS.PENDING };
6060

61-
if (email) {
61+
if (email && userId) {
62+
_.assign(where, { $or: [{ email: { $eq: email } }, { userId: { $eq: userId } }] });
63+
} else if (email) {
6264
_.assign(where, { email });
6365
} else if (userId) {
6466
_.assign(where, { userId });
@@ -70,7 +72,9 @@ module.exports = function defineProjectMemberInvite(sequelize, DataTypes) {
7072
getProjectInvitesForUser(email, userId) {
7173
const where = { status: INVITE_STATUS.PENDING };
7274

73-
if (email) {
75+
if (email && userId) {
76+
_.assign(where, { $or: [{ email: { $eq: email } }, { userId: { $eq: userId } }] });
77+
} else if (email) {
7478
_.assign(where, { email });
7579
} else if (userId) {
7680
_.assign(where, { userId });

0 commit comments

Comments
 (0)