From eb3df1c2e2be181b187c7cc6f6915f1d3e457ce5 Mon Sep 17 00:00:00 2001 From: Anmol Brar <83686967+brarsanmol@users.noreply.github.com> Date: Thu, 20 Jan 2022 23:26:34 -0500 Subject: [PATCH 1/4] feat(hacker.js,hacker.middleware.js): add ability for discord verification. (#795) * feat(hacker.js,hacker.middleware.js): add ability for discord verification.. * fix(hacker.js): typo in middleware function call. * add postDiscord role/route * Fix hacker discord route Co-authored-by: meldunn --- .gitignore | 1 + constants/role.constant.js | 1 + constants/routes.constant.js | 13 ++++++++++++- middlewares/hacker.middleware.js | 8 +++++++- package-lock.json | 4 ++-- routes/api/hacker.js | 17 +++++++++++++++++ 6 files changed, 40 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 1017d8ff..0d0b4aab 100755 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,4 @@ assets/.DS_Store #secrets secret.yaml +package-lock.json diff --git a/constants/role.constant.js b/constants/role.constant.js index dfee5c3e..562a85e8 100644 --- a/constants/role.constant.js +++ b/constants/role.constant.js @@ -37,6 +37,7 @@ const hackerRole = { Constants.Routes.hackerRoutes.patchSelfById, Constants.Routes.hackerRoutes.patchSelfConfirmationById, Constants.Routes.hackerRoutes.getSelf, + Constants.Routes.hackerRoutes.postDiscord, Constants.Routes.travelRoutes.getSelf, Constants.Routes.travelRoutes.getSelfById, diff --git a/constants/routes.constant.js b/constants/routes.constant.js index 79d4c460..e880674d 100644 --- a/constants/routes.constant.js +++ b/constants/routes.constant.js @@ -6,7 +6,7 @@ * ===***===***===***===***===***===***===***===***=== * * If you are adding a route to this list, update this number - * next avaiable createFromTime value: 166 + * next avaiable createFromTime value: 168 * * If you are deleting a route from this list, please add the ID to the list of 'reserved' IDs, * so that we don't accidentally assign someone to a given ID. @@ -203,6 +203,12 @@ const hackerRoutes = { uri: "/api/hacker/email/dayOf/" + Constants.ROLE_CATEGORIES.SELF, _id: mongoose.Types.ObjectId.createFromTime(134) } + // }, + // postDiscord: { + // requestType: Constants.REQUEST_TYPES.POST, + // uri: "/api/hacker/discord", + // _id: mongoose.Types.ObjectId.createFromTime(167) + // } }; const travelRoutes = { @@ -363,6 +369,11 @@ const staffRoutes = { requestType: Constants.REQUEST_TYPES.GET, uri: "/api/account/invite", _id: mongoose.Types.ObjectId.createFromTime(162) + }, + postDiscord: { + requestType: Constants.REQUEST_TYPES.POST, + uri: "/api/hacker/discord", + _id: mongoose.Types.ObjectId.createFromTime(167) } }; diff --git a/middlewares/hacker.middleware.js b/middlewares/hacker.middleware.js index fa75accb..26935ade 100644 --- a/middlewares/hacker.middleware.js +++ b/middlewares/hacker.middleware.js @@ -874,6 +874,11 @@ async function getStats(req, res, next) { next(); } +function addIdToCheckStatus(req, res, next) { + req.params.id = req.body.hacker.id; + return next(); +} + module.exports = { parsePatch: parsePatch, parseHacker: parseHacker, @@ -929,5 +934,6 @@ module.exports = { findByEmail: Middleware.Util.asyncMiddleware(findByEmail), obtainEmailByHackerId: Middleware.Util.asyncMiddleware( obtainEmailByHackerId - ) + ), + addIdToCheckStatus: addIdToCheckStatus }; diff --git a/package-lock.json b/package-lock.json index 6dc97087..26be99d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "hackerAPI", - "version": "3.1.3", + "version": "3.1.6", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "3.1.3", + "version": "3.1.6", "dependencies": { "@google-cloud/storage": "^5.8.5", "@sendgrid/mail": "^6.5.5", diff --git a/routes/api/hacker.js b/routes/api/hacker.js index d3da1d65..77cb1d43 100644 --- a/routes/api/hacker.js +++ b/routes/api/hacker.js @@ -905,6 +905,23 @@ module.exports = { Controllers.Hacker.sentDayOfEmail ); + hackerRouter.route("/discord").post( + Middleware.Auth.ensureAuthenticated(), + Middleware.Auth.ensureAuthorized(), + + // Middleware.parseBody.middleware, + Middleware.Hacker.findByEmail, + Middleware.Hacker.addIdToCheckStatus, + Middleware.Hacker.checkStatus([ + CONSTANTS.HACKER_STATUS_ACCEPTED, + CONSTANTS.HACKER_STATUS_CONFIRMED + ]), + Middleware.Hacker.parseCheckIn, + Middleware.Hacker.updateHacker, + Middleware.Hacker.sendStatusUpdateEmail, + Controllers.Hacker.updatedHacker + ); + apiRouter.use("/hacker", hackerRouter); } }; From efc77e356b6fa922016530c083a420975f96d6aa Mon Sep 17 00:00:00 2001 From: Yun Kai Peng <45922265+pengyk@users.noreply.github.com> Date: Fri, 21 Jan 2022 12:35:28 -0500 Subject: [PATCH 2/4] change invite to disc (#799) * change invite to disc * remove fb group --- assets/email/statusEmail/Checked-in.hbs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/assets/email/statusEmail/Checked-in.hbs b/assets/email/statusEmail/Checked-in.hbs index 4c0bf4c3..6f029786 100644 --- a/assets/email/statusEmail/Checked-in.hbs +++ b/assets/email/statusEmail/Checked-in.hbs @@ -390,11 +390,8 @@ This email is to confirm your check-in at McHacks!

Don't forget to join the McHacks participants Facebook - group and Slack + href="https://discord.com/invite/fqbjr43cKf" + style="-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;color:#F2463A;text-decoration:none;">Discord for announcements, to chat with other hackers, ask questions, and form teams! From d7f9ca4b59dfd8ba4ac64c657ec5e409b781238a Mon Sep 17 00:00:00 2001 From: Anmol Brar <83686967+brarsanmol@users.noreply.github.com> Date: Sat, 5 Nov 2022 12:36:30 -0400 Subject: [PATCH 3/4] fix/update emails (#882) * feat(hacker.js,hacker.middleware.js): add ability for discord verification.. * fix(hacker.js): typo in middleware function call. * add postDiscord role/route * fix: update applied email Co-authored-by: meldunn --- assets/email/AccountInvitation.hbs | 2 +- assets/email/statusEmail/Applied.hbs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/email/AccountInvitation.hbs b/assets/email/AccountInvitation.hbs index d722116b..51e3ac2c 100644 --- a/assets/email/AccountInvitation.hbs +++ b/assets/email/AccountInvitation.hbs @@ -392,7 +392,7 @@ have resume access you will be able to download hacker resumes through the dashboard.

- Sponsor check-in starts at 6:00 pm on Friday, January 21st on the + Sponsor check-in starts at 6:00 pm on Saturday, January 28th on the McHacks Discord server and opening ceremonies will begin at 7:00 pm. Be sure to get set up on the McHacks Discord server at hacker dashboard until the deadline on December - 26th at - 12:00pm ET. + style="-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;font-weight: 700;">January + 13th at + 11:59 PM ET.

In the meantime, follow us on Facebook, From 804243ee561c20c0b18c3db78bf3ccf894f92596 Mon Sep 17 00:00:00 2001 From: Anmol Brar <83686967+brarsanmol@users.noreply.github.com> Date: Tue, 17 Jan 2023 09:25:13 -0500 Subject: [PATCH 4/4] Jacky/email (#900) * fix: change to mchacks 10 in email templates * fix: dates * fix: move confirmation date +1 day Co-authored-by: Jacky Zhang --- assets/email/Ticket.hbs | 22 +++++++++++----------- assets/email/Welcome.hbs | 18 +++++++++--------- assets/email/marketingEmail/3Days.hbs | 2 +- assets/email/marketingEmail/EmailBlast.hbs | 2 +- assets/email/statusEmail/Accepted.hbs | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/assets/email/Ticket.hbs b/assets/email/Ticket.hbs index a6ee46bf..376af42f 100644 --- a/assets/email/Ticket.hbs +++ b/assets/email/Ticket.hbs @@ -333,7 +333,7 @@ - McHacks 6: Important Information + McHacks 10: Important Information @@ -367,11 +367,11 @@

4 - Days until McHacks 6!

+ Days until McHacks 10!

Hi {{firstName}}!

- McHacks 6 is this coming weekend and we're excited to spend an epic + McHacks 10 is this coming weekend and we're excited to spend an epic weekend with you hacking away! πŸŽ‰

Before we get to that, let's go through some important information to @@ -383,9 +383,9 @@ with other hackers, and form teams!

During the hackathon, we'll be using both the FB group and the official - McHacks - 6 Slack. Be sure to join the Slack so you're updated on + 10 Discord. Be sure to join the Discord so you're updated on everything going on as they happen!

We'll also have a live site with the schedule, announcements, and @@ -420,7 +420,7 @@ together. πŸƒ

Transportation

- McHacks 6 will be hosted at Theatre St James in the Old Port of Montreal.

@@ -433,8 +433,8 @@ Policy All projects built at our hackathon can be made by teams of 1-4 people. If you're looking to find like-minded participants to work with, you - can post in our Facebook - group or in #team-formation on Slack. + can post in our Facebook + group or in #team-formation on Discord.

In the interest of fairness, participants aren't allowed to work on pre-existing projects or begin their projects before hacking at McHacks @@ -443,7 +443,7 @@

That being said, you're more than welcome to familiarize yourself with all the tech and tools you intend to build with beforehand! You can - check our Devpost + check our Devpost which will be updated soon with our available prizes to inspire ideas for your project! 🎁

@@ -452,7 +452,7 @@ Follow us on Facebook, Twitter, and Instagram - for important updates and news about McHacks 6! If you have any + for important updates and news about McHacks 10! If you have any questions, feel free to reach out at contact@mchacks.ca.

@@ -497,4 +497,4 @@ - \ No newline at end of file + diff --git a/assets/email/Welcome.hbs b/assets/email/Welcome.hbs index ae69d24d..154e85d0 100644 --- a/assets/email/Welcome.hbs +++ b/assets/email/Welcome.hbs @@ -333,7 +333,7 @@ - McHacks 6: Important Information + McHacks 10: Important Information @@ -367,12 +367,12 @@

- Welcome to McHacks 6! + Welcome to McHacks 10!

Hi {{firstName}}!

- McHacks 6 is finally here, and we're excited to spend an epic + McHacks 10 is finally here, and we're excited to spend an epic weekend with you hacking away! πŸŽ‰

Before we get to that, let's go through some important information to @@ -384,9 +384,9 @@ with other hackers, and form teams!

During the hackathon, we'll be using both the FB group and the official - McHacks - 6 Slack. Be sure to join the Slack so you're updated on + 10 Discord. Be sure to join the Discord so you're updated on everything going on as they happen!

We'll also have a live site with the schedule, announcements, and @@ -397,8 +397,8 @@ Policy All projects built at our hackathon can be made by teams of 1-4 people. If you're looking to find like-minded participants to work with, you - can post in our Facebook - group or in #team-formation on Slack. + can post in our Facebook + group or in #team-formation on Discord.

In the interest of fairness, participants aren't allowed to work on pre-existing projects or begin their projects before hacking at McHacks @@ -416,7 +416,7 @@ Follow us on Facebook, Twitter, and Instagram - for important updates and news about McHacks 6! If you have any + for important updates and news about McHacks 10! If you have any questions, feel free to reach out at contact@mchacks.ca.

@@ -461,4 +461,4 @@ - \ No newline at end of file + diff --git a/assets/email/marketingEmail/3Days.hbs b/assets/email/marketingEmail/3Days.hbs index b0ad126f..d0c05b1c 100644 --- a/assets/email/marketingEmail/3Days.hbs +++ b/assets/email/marketingEmail/3Days.hbs @@ -384,7 +384,7 @@ style="-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;color:#4D4D4D;">

There’s just 3 days left to apply to Canada’s favorite hackathon! Have - you started your McHacks 7 application yet? What are you waiting for? + you started your McHacks 10 application yet? What are you waiting for?

McHacks is back this winter for round 7! Join us February 1-2, 2020 in the beautiful city of Montreal for a weekend full of engaging workshops, diff --git a/assets/email/marketingEmail/EmailBlast.hbs b/assets/email/marketingEmail/EmailBlast.hbs index 24dc9ba0..59fad53a 100644 --- a/assets/email/marketingEmail/EmailBlast.hbs +++ b/assets/email/marketingEmail/EmailBlast.hbs @@ -384,7 +384,7 @@

πŸ’» Getting the latest McHacks update...

- πŸš€ Update complete. You're now ready for McHacks 7! πŸ˜€πŸŽ‰ + πŸš€ Update complete. You're now ready for McHacks 10! πŸ˜€πŸŽ‰

Canada's favorite hackathon is back again this winter and better than ever! Join us on February 1-2, 2020 for a weekend full of engaging diff --git a/assets/email/statusEmail/Accepted.hbs b/assets/email/statusEmail/Accepted.hbs index 28a6abf1..cf187496 100644 --- a/assets/email/statusEmail/Accepted.hbs +++ b/assets/email/statusEmail/Accepted.hbs @@ -392,7 +392,7 @@

Confirm your attendance on our hacker - dashboard no later than January 17th at 11:59PM EST. + dashboard no later than January 21th at 11:59PM EST.

If you can no longer attend McHacks, please let us know as soon as possible by withdrawing your application on our