Skip to content

[HOTFIX] [DEV] Post release 2.3.1 #549

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 2 commits into from
Apr 17, 2020
Merged
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
9 changes: 8 additions & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ _.assignIn(util, {

const isAdmin = util.hasPermission({ topcoderRoles: [USER_ROLE.TOPCODER_ADMIN] }, req.authUser);
const currentUserId = req.authUser.userId;
const currentUserEmail = req.authUser.email;

// admins can get data as it is
if (isAdmin) {
Expand All @@ -669,7 +670,13 @@ _.assignIn(util, {
const canSeeEmail = (
isAdmin || // admin
invite.createdBy === currentUserId || // user who created invite
invite.userId === currentUserId // user who is invited
(invite.userId !== null && invite.userId === currentUserId) || // user who is invited by `handle`
( // user who is invited by `email` (invite doesn't have `userId`)
invite.userId === null &&
invite.email &&
currentUserEmail &&
invite.email.toLowerCase() === currentUserEmail.toLowerCase()
)
);
// mask email if user cannot see it
_.assign(invite, {
Expand Down