Skip to content

Hotfix/project member invite case sensitive #325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/models/projectMemberInvite.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ module.exports = function defineProjectMemberInvite(sequelize, DataTypes) {
const where = { projectId, status: INVITE_STATUS.PENDING };

if (email && userId) {
_.assign(where, { $or: [{ email: { $eq: email } }, { userId: { $eq: userId } }] });
_.assign(where, { $or: [
{ email: { $eq: email.toLowerCase() } },
{ userId: { $eq: userId } },
] });
} else if (email) {
_.assign(where, { email });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vikasrohit It looks like we also have to fix this line even though currently we don't use this method with email only for now, but we can do in the future theoretically.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, sure. I would do the change in dev branch directly.

} else if (userId) {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/projectMemberInvites/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ module.exports = [
req.app.emit(EVENT.ROUTING_KEY.PROJECT_MEMBER_INVITE_CREATED, {
req,
userId: v.userId,
email: v.email,
email: v.email ? v.email.toLowerCase() : v.email,
status: v.status,
role: v.role,
});
Expand Down