Skip to content

#2501 add reviewers comment to slack message#2872

Merged
walker-sean merged 6 commits intodevelopfrom
#2501-add-reviewers-comment-to-slack-message
Nov 14, 2024
Merged

#2501 add reviewers comment to slack message#2872
walker-sean merged 6 commits intodevelopfrom
#2501-add-reviewers-comment-to-slack-message

Conversation

@AdityaBoddepalli
Copy link
Copy Markdown
Contributor

@AdityaBoddepalli AdityaBoddepalli commented Oct 8, 2024

Changes

Changed the existing method to add reviewers comment to the string that gets sent as a slack message

Test Cases

Tested by creating and reviewing a CR using the UI.

Screenshots

image

To Do

None

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots section)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No yarn.lock changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #2501

@AdityaBoddepalli AdityaBoddepalli marked this pull request as ready for review October 8, 2024 22:58
}
});

const newCR = await prisma.change_Request.findUnique({
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.

Why do you need to make a new variable instead of just using the updated changed request above, and editing its include args?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I make a new variable as changing the updated variable's include args will mess with the sendSlackCRStatusToThread function call which uses updated.notificationSlackThreads.

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.

You can have the notificationSlackThreads and also the change request query args in the same include statement

const msgs = [];
const fullMsg = `:tada: Your Change Request was just reviewed! Click the link to view! :tada:`;
let fullMsg;
if (!comments) {
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.

Can you simplify this if-else block by using a ternary operator?

Copy link
Copy Markdown
Contributor

@vsp05 vsp05 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 to me, other than Alan's requested changes. When that is replaced with a ternary operator I'll approve. Also, I played around with the newCr a bit, and I think I agree with the way you did it.

Copy link
Copy Markdown
Contributor

@alaneng-neu alaneng-neu left a comment

Choose a reason for hiding this comment

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

Small nitpicks

const msgs = [];
const fullMsg = `:tada: Your Change Request was just reviewed! Click the link to view! :tada:`;
// let fullMsg;
const fullMsg = !comments
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.

The ternary can be inline in the string because in this case there is still repetition of the string when there is and isn't comments. For example "...reviewed!\n${comments ? 'some string with the comments' : ''}..."

await this.reviewActivationChangeRequest(foundCR, reviewer);
}

const includeArgs = getChangeRequestQueryArgs(organization.organizationId).include;
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.

This can just be in the include: {}, doesn't need a variable if it is only being used once

alaneng-neu
alaneng-neu previously approved these changes Oct 22, 2024
Copy link
Copy Markdown
Contributor

@alaneng-neu alaneng-neu left a comment

Choose a reason for hiding this comment

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

LGTM

if (process.env.NODE_ENV !== 'production') return; // don't send msgs unless in prod
const msgs = [];
const fullMsg = `:tada: Your Change Request was just reviewed! Click the link to view! :tada:`;
// let fullMsg;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove this

@walker-sean walker-sean merged commit 4c4ab80 into develop Nov 14, 2024
@walker-sean walker-sean deleted the #2501-add-reviewers-comment-to-slack-message branch November 14, 2024 21:12
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.

Slack - Add Change Request Review Message to Reviewed Slack Ping

4 participants