Skip to content

feat: add technique proposal rejection comment - #1703

Open
ellen-wright wants to merge 26 commits into
developfrom
1533-add-technique-proposal-rejection-comment
Open

feat: add technique proposal rejection comment#1703
ellen-wright wants to merge 26 commits into
developfrom
1533-add-technique-proposal-rejection-comment

Conversation

@ellen-wright

Copy link
Copy Markdown
Contributor

Description

refs: UserOfficeProject/issue-tracker#1533

Motivation and Context

Experiment Scientists would like to add a comment to emails when setting status to unsuccessful to explain their reasoning. Currently someone will reach out separately after this so this will give the user extra information on the proposal decision.
This PR allows a comment tot be given once the status of a technique proposal is set to 'Unsuccessful'.

Changes

  • New database table - similar to Internal Scientist Comment
  • create mutation that checks if any previous comment was made for this proposal - this can only happen if a User Officer sets the status to a different status then back to unsuccessful and give a new comment.
  • get function to retrieve the comment and allow it to be shown in an email to the user.
  • A new modal that appears when the status of a technique proposal is set to unsuccessful
    • This allows the option for no comment to be set
    • This modal appears before the confirmation to change the status - if the user does not confirm the status change the rejection comment will not be set
  • The rejection comment is exposed to be able to be used in emails
  • e2e tests added

Tests included/Docs Updated?

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

@ellen-wright
ellen-wright requested a review from a team as a code owner August 3, 2026 10:46
@ellen-wright
ellen-wright requested review from William-Edwards-STFC and removed request for a team August 3, 2026 10:46
@ellen-wright ellen-wright changed the title 1533 add technique proposal rejection comment feat: add technique proposal rejection comment Aug 3, 2026
@ellen-wright
ellen-wright removed the request for review from William-Edwards-STFC August 3, 2026 10:46
@ellen-wright
ellen-wright marked this pull request as draft August 3, 2026 10:46
@ellen-wright
ellen-wright marked this pull request as ready for review August 4, 2026 07:17
Comment on lines +671 to +672
// Do you want to add a comment
console.log('HEREEEEEEE!!!!!!!!!!');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We may need to remove this.

proposalTemplate: recipientWithData.proposalTemplate,
samples: recipientWithData.samples,
hazards: recipientWithData.hazards,
rejectionComment: recipientWithData,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We need to pass rejectionComment only here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
rejectionComment: recipientWithData,
rejectionComment: recipientWithData.rejectionComment,

.getProposalRejectionComment(proposalPk)
.catch((error) => {
return rejection(
`Could not get proposal scientist comment proposal: '${proposalPk}'`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We might wan to say Could not get proposal rejection comment

Comment on lines +390 to +398
if (value === StatusCode.UNSUCCESSFUL && comment != '') {
api({
toastSuccessMessage:
'Proposal rejection comment successfully created',
}).createProposalRejectionComment({
proposalPk: unsuccessfullPK,
comment: comment ?? '',
});
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here if updateProposalStatus fails we may need to skip updating the comment.

proposalTemplate: recipientWithData.proposalTemplate,
samples: recipientWithData.samples,
hazards: recipientWithData.hazards,
rejectionComment: recipientWithData,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
rejectionComment: recipientWithData,
rejectionComment: recipientWithData.rejectionComment,

Comment thread apps/backend/db_patches/0213_AddProposalRejectionCommentTable.sql
Comment thread apps/backend/db_patches/0213_AddProposalRejectionCommentTable.sql Outdated
Comment thread apps/frontend/src/components/techniqueProposal/TechniqueProposalTable.tsx Outdated
Comment thread apps/frontend/src/components/techniqueProposal/TechniqueProposalTable.tsx Outdated
Comment thread apps/backend/src/datasources/postgres/ProposalInternalCommentsDataSource.ts Outdated
Comment thread apps/backend/src/queries/ProposalQueries.ts

@jekabs-karklins jekabs-karklins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good form my side

.should('not.exist');
});

it('Scientist should be able to add a rejection comment when changing status to unsuccessful', function () {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I’m also aware that User Officers may be able to make these changes. Is it worth confirming whether this is actually the case? If so, we should add a test to cover that scenario as well.

@yoganandaness
yoganandaness removed their request for review August 28, 2026 09:13
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.

3 participants