Skip to content

fix(PM-1169): send source to accept or decline invite API #1650

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
Jun 3, 2025
Merged

Conversation

hentrymartin
Copy link
Collaborator

What's in this PR?

  • send source to accept or decline invite API

Ticket link - https://topcoder.atlassian.net/browse/PM-1169

@@ -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) => {

Choose a reason for hiding this comment

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

The updateInvite function now requires a source parameter, but it's not clear from the diff how this parameter is being passed when updateInvite is called. Ensure that all calls to updateInvite are updated to include the source argument.

@@ -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])

Choose a reason for hiding this comment

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

The variable source is used here, but it is not clear from the diff where it is defined or how it is being set. Ensure that source is properly initialized and passed to this component.

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])
const declineInvite = useCallback(() => updateInvite(PROJECT_MEMBER_INVITE_STATUS_REFUSED, source), [updateInvite, source])

Choose a reason for hiding this comment

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

Similar to the previous line, ensure that the source variable is correctly defined and initialized before being used in this function.

@@ -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) {

Choose a reason for hiding this comment

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

The function updateProjectMemberInvite now includes a new parameter source. Ensure that all calls to this function in the codebase are updated to pass this new parameter to avoid potential runtime errors.

Copy link
Contributor

@kkartunov kkartunov left a comment

Choose a reason for hiding this comment

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

Looks good.

@kkartunov kkartunov merged commit a211634 into develop Jun 3, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants