Skip to content

Conversation

@janekhuong
Copy link
Contributor

@janekhuong janekhuong commented Oct 21, 2025

Tickets:

  • HAC-

List of changes:

  • Added backend functionality for sending batch decision emails

Type of change

  • New feature (non-breaking change which adds functionality)

How has this been tested?

Create test hackers with valid email addresses. In staff dashboard, change their statuses to accepted/declined. Click "Send Emails" button, choose to send acceptance or declined emails, and then confirm.

Questions for code reviewers?

  • Middleware.Auth.ensureAuthorized() calls in emails.js is failing; commented out for now but will figure it out

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Listed change(s) in the Changelog
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules

*/
automatedEmailRouter.route("/automated/status/:status/count").get(
Middleware.Auth.ensureAuthenticated(),
// Middleware.Auth.ensureAuthorized(),

Choose a reason for hiding this comment

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

In the future we can include the handling for the :status parameter for ensureAuthorized in auth.service.js. i'm assuming since it's commented out, currently any hacker can send batch emails using the API bc there's no check to see if api/email/automated/... route is included in the executing user's role.

Copy link
Contributor

Choose a reason for hiding this comment

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

can we test this? log in as a hacker and try to execute the route in the console. we definitely need to have validation there

Copy link
Contributor

Choose a reason for hiding this comment

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

we can add permissions for this route to the staff role in the database, and then it should be fine. @janekhuong did you try that? do you need help figuring that out?

Copy link

@joshuazhou744 joshuazhou744 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, I also tested it once locally. Only thing is there's no user validation for who can use this route (api/email/...)

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.

4 participants