Skip to content

Conversation

@yoganandaness
Copy link
Contributor

@yoganandaness yoganandaness commented Nov 13, 2025

Description

Allow co-proposer invitees to accept their invitation and join a proposal without needing to enter an invite code. This streamlines the process for co-proposers, making it easier for them to join proposals they have been invited to.

Motivation and Context

Previously, co-proposer invitees were required to enter an invite code to accept their invitation and join a proposal. This change removes that requirement, improving the user experience and reducing friction for co-proposers joining proposals.

How Has This Been Tested

  • Updated and ran backend unit tests in InviteMutations.spec.ts to cover the new flow.
  • Verified invite acceptance and joining behavior via e2e Cypress tests in invites.cy.ts.
  • Manually tested the frontend invite acceptance flow to ensure co-proposers can join without entering a code.

Fixes

Fixes part of the user story for automatic joining of invitees as co-proposers.

Changes

  • Modified backend invite acceptance logic in InviteMutations.ts to allow co-proposer invites to be accepted without a code.
  • Updated related tests in InviteMutations.spec.ts and e2e tests in invites.cy.ts.
  • Adjusted frontend logic in AcceptInvite.tsx to support the new flow.

Depends on

N/A

Tests included/Docs Updated?

  • I have added tests to cover my changes.
  • All relevant doc has been updated

@yoganandaness yoganandaness requested a review from a team as a code owner November 13, 2025 23:11
@yoganandaness yoganandaness requested review from simonfernandes and removed request for a team November 13, 2025 23:11
@yoganandaness yoganandaness changed the title Swap 4914 user office automatic joining of invitees to the feat: user office automatic joining of invitees to the Nov 13, 2025
@yoganandaness yoganandaness enabled auto-merge (squash) November 13, 2025 23:12
@yoganandaness
Copy link
Contributor Author

Screenshot 2025-11-06 at 09 44 25 Screenshot 2025-11-06 at 09 44 28

Copy link
Contributor

@simonfernandes simonfernandes left a comment

Choose a reason for hiding this comment

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

Just some minor comments/questions. We won't be using this at STFC but it looks like a cool feature 🤩

Comment on lines 91 to 93
if (!agent) {
return rejection('User not found', { proposalId });
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be done before getting the proposal

return rejection('Invite not found', { proposalId });
}

const updatedInvite = await this.inviteDataSource.update({
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be safer to update the invite after the processing of the claims below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@simonfernandes Absolutely. It make sense to update after processing the claims.

It was earlier in this way. i changed it to fix the issue, where the email handler was not able to fetch the claimedByUserId, as it was not updated to the invite. So i fixed the issue by flipping the logic, so that invite is updated first.

I now get the importance of the order and realized this could be resolved in other way as well, which i have done in this PR in essEmailHandler.

Thanks @simonfernandes

{invite.proposal.title || 'No Title'}
</Typography>
<Typography variant="body1" color="textSecondary">
Principal Investigator: {invite.proposal.proposerName}
Copy link
Contributor

Choose a reason for hiding this comment

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

If inviting others is not restricted to the proposer, is it useful to show who has sent the invite?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are already including the information in the Email about the inviter. So, thought it would be minimal to just include the Proposal number and the PI and abstract away all the other information.

However, It is a good point and i will discuss with the team and reserve this for a later PR, if it is fine for you.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes of course, just thought to mention it in case it would be useful, but if there's no practical use for it then there's no point adding it for the sake of it 🙂

FROM invites
WHERE email = '[email protected]' AND code = 'BEN002';

INSERT INTO co_proposer_claims (invite_id, proposal_pk) VALUES (invite_id_var3, 2);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder why we actually need this table. Is it possible to create a single invitation for multiple proposals? If not, proposal_pk could be part of invites table.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not yet likely that an invite could be used for more than one proposal. However, the whole design is it make sure that the invite system works not just for entity like Proposal, but also for other entities like Reviewers, Instrument Scientist, Visits etc.,

@yoganandaness yoganandaness requested a review from gnyiri November 18, 2025 18:12
@github-actions github-actions bot force-pushed the SWAP-4914-user-office-automatic-joining-of-invitees-to-the branch from 8fb99c8 to 089815a Compare November 21, 2025 10:47
@github-actions github-actions bot force-pushed the SWAP-4914-user-office-automatic-joining-of-invitees-to-the branch from 089815a to cdc2577 Compare November 25, 2025 16:22
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.

5 participants