-
Notifications
You must be signed in to change notification settings - Fork 51
[PROD RELEASE] #1653
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
[PROD RELEASE] #1653
Changes from 4 commits
4ec89b1
6b81b05
cd5322c
1e3c8e0
0eb4fb3
8390251
713528f
a211634
6063bbe
f489bae
0b819d7
fc93578
9c67f2b
3b67a7e
153ab96
1aa70f4
78755ed
b3eb22c
612a798
8d4d3a8
37c544a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,8 @@ const ProjectInvitations = ({ match, auth, isProjectLoading, history, projectDet | |
const [isUpdating, setIsUpdating] = useState(automaticAction || false) | ||
const isAccepting = isUpdating === PROJECT_MEMBER_INVITE_STATUS_ACCEPTED | ||
const isDeclining = isUpdating === PROJECT_MEMBER_INVITE_STATUS_REFUSED | ||
const queryParams = new URLSearchParams(window.location.search) | ||
const source = queryParams.get('source') | ||
|
||
useEffect(() => { | ||
if (!projectId) { | ||
|
@@ -42,9 +44,9 @@ const ProjectInvitations = ({ match, auth, isProjectLoading, history, projectDet | |
} | ||
}, [projectId, auth, projectDetail, isProjectLoading, history]) | ||
|
||
const updateInvite = useCallback(async (status) => { | ||
const updateInvite = useCallback(async (status, source) => { | ||
setIsUpdating(status) | ||
await updateProjectMemberInvite(projectId, invitation.id, status) | ||
await updateProjectMemberInvite(projectId, invitation.id, status, source) | ||
|
||
// await for the project details to propagate | ||
await delay(1000) | ||
|
@@ -56,8 +58,8 @@ const ProjectInvitations = ({ match, auth, isProjectLoading, history, projectDet | |
history.push(status === PROJECT_MEMBER_INVITE_STATUS_ACCEPTED ? `/projects/${projectId}/challenges` : '/projects') | ||
}, [projectId, invitation, loadProjectInvites, history]) | ||
|
||
const acceptInvite = useCallback(() => updateInvite(PROJECT_MEMBER_INVITE_STATUS_ACCEPTED), [updateInvite]) | ||
const declineInvite = useCallback(() => updateInvite(PROJECT_MEMBER_INVITE_STATUS_REFUSED), [updateInvite]) | ||
const acceptInvite = useCallback(() => updateInvite(PROJECT_MEMBER_INVITE_STATUS_ACCEPTED, source), [updateInvite, source]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
const declineInvite = useCallback(() => updateInvite(PROJECT_MEMBER_INVITE_STATUS_REFUSED, source), [updateInvite, source]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
||
useEffect(() => { | ||
if (!invitation || !automaticAction) { | ||
|
@@ -69,7 +71,7 @@ const ProjectInvitations = ({ match, auth, isProjectLoading, history, projectDet | |
} else if (automaticAction === PROJECT_MEMBER_INVITE_STATUS_REFUSED) { | ||
declineInvite() | ||
} | ||
}, [invitation, automaticAction]) | ||
}, [invitation, automaticAction, source]) | ||
|
||
return ( | ||
<> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,9 @@ import { PROJECTS_API_URL } from '../config/constants' | |
* @param {string} status the new status for invitation | ||
* @return {object} project member invite returned by api | ||
*/ | ||
export function updateProjectMemberInvite (projectId, inviteId, status) { | ||
export function updateProjectMemberInvite (projectId, inviteId, status, source) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function |
||
const url = `${PROJECTS_API_URL}/${projectId}/invites/${inviteId}` | ||
return axios.patch(url, { status }) | ||
return axios.patch(url, { status, source }) | ||
.then(resp => resp.data) | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
updateInvite
function now takes an additionalsource
parameter, but it's not clear how this parameter is being used within the function. Ensure that thesource
parameter is necessary and is being utilized appropriately in theupdateProjectMemberInvite
function.