Skip to content

fix: technique proposal rejection comment set before proposal status change - #1847

Open
ellen-wright wants to merge 9 commits into
developfrom
fix-rejection-comment-email-bug
Open

ellen-wright wants to merge 9 commits into
developfrom
fix-rejection-comment-email-bug

Conversation

@ellen-wright

Copy link
Copy Markdown
Contributor

Description

As part of UserOfficeProject/issue-tracker#1533

Motivation and Context

The comment that can be set by a scientist when a technique proposal's status is set to 'Unsuccessful' was not being populated correctly in the status action emails sent upon status change.

Fixes

The order of the comment being set in the database and the status being changed in the workflow (therefore sending any status action emails) has been switched to make sure the comment is available to be sent in the 'Unsuccessful' email to users.

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 September 30, 2026 13:37
@ellen-wright
ellen-wright requested review from SourangshuSTFC and removed request for a team September 30, 2026 13:37

@mutambaraf mutambaraf 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.

On this line

we can also update it so we only insert if delete is sucessfull `async createRejectionComment(
args: CreateProposalInternalCommentArgs
): Promise {
try {
const [proposalRejectionComment]: ProposalInternalCommentRecord[] =
await database.transaction(async (trx) => {
await trx(
'proposal_rejection_comments'
)
.where('proposal_pk', args.proposalPk)
.del();

      return trx('proposal_rejection_comments')
        .insert({
          proposal_pk: args.proposalPk,
          comment: args.comment,
        })
        .returning('*');
    });
  if (!proposalRejectionComment) {
    throw new GraphQLError(
      'Proposal rejection comment could not be created'
    );
  }

  return createProposalInternalCommentObject(proposalRejectionComment);
} catch (error) {
  logger.logException(
    `Could not create proposal rejection comment with args: '${JSON.stringify(args)}'`,
    error
  );
  throw new GraphQLError('Error while creating proposal rejection comment');
}

}`

@ellen-wright ellen-wright self-assigned this Oct 1, 2026
@jekabs-karklins
jekabs-karklins self-requested a review October 2, 2026 12:00
Comment on lines +89 to 93
logger.logException(
`Could not create proposal rejection comment with args: '${JSON.stringify(args)}'`,
error
);
throw new GraphQLError('Error while creating proposal rejection comment');

@jekabs-karklins jekabs-karklins Oct 2, 2026 •

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.

suggestion: Can we move the args into the context parameter? The reason is that we would like to use the exception title for aggregation, i.e. no dynamic values in the title.

Suggested change
logger.logException(
`Could not create proposal rejection comment with args: '${JSON.stringify(args)}'`,
error
);
throw new GraphQLError('Error while creating proposal rejection comment');
logger.logException(
`Could not create proposal rejection comment`,
error,
args
);
throw new GraphQLError('Error while creating proposal rejection comment');

@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.

Just a small comment

@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.

💯

@mutambaraf mutambaraf 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.

LGTM

'Proposal rejection comment successfully created',
})
.createProposalRejectionComment({
proposalPk: unsuccessfullPK,

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 use primaryKey instead of unsuccessfullPK.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants