From 62fa96238ad300deec2a1ffd0dfe1677de8505b6 Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Tue, 27 Feb 2024 16:39:01 -0700 Subject: [PATCH 1/4] Error handling on emails --- src/api/src/services/email-service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/src/services/email-service.ts b/src/api/src/services/email-service.ts index 8242991..c2763eb 100644 --- a/src/api/src/services/email-service.ts +++ b/src/api/src/services/email-service.ts @@ -95,6 +95,11 @@ export class EmailService { return null; } - return this.transport.sendMail(message); + return this.transport + .sendMail(message) + .then((resp) => resp) + .catch((err) => { + console.log("EMAILING ERROR", err); + }); } } From 5e7ed2e067370188a23b4767c9c5f6327c54e73e Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Tue, 27 Feb 2024 16:39:17 -0700 Subject: [PATCH 2/4] Remove debugging --- src/api/src/routes/question-router.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/api/src/routes/question-router.ts b/src/api/src/routes/question-router.ts index f160881..cb7cb8a 100644 --- a/src/api/src/routes/question-router.ts +++ b/src/api/src/routes/question-router.ts @@ -55,9 +55,7 @@ questionRouter.post("/:id/send-email-test", checkJwt, loadUser, async (req: Requ const { id } = req.params; let { subject, body, recipients } = req.body; let token = "123456789"; - - console.log("eq body", req.body); - + if (recipients.includes("Opinionators")) { await emailService.sendOpinionatorEmail( { email: req.user.EMAIL, fullName: `${req.user.FIRST_NAME} ${req.user.LAST_NAME}` }, From bac23c00a122588af387f0ad7b7dd21a4fc8d9da Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Tue, 27 Feb 2024 16:48:18 -0700 Subject: [PATCH 3/4] Regex change to test valid emails --- .../administration/modules/participants/store/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/web/src/modules/administration/modules/participants/store/index.ts b/src/web/src/modules/administration/modules/participants/store/index.ts index b824ac7..abfbfb1 100644 --- a/src/web/src/modules/administration/modules/participants/store/index.ts +++ b/src/web/src/modules/administration/modules/participants/store/index.ts @@ -50,9 +50,9 @@ export const useParticipantsStore = defineStore("participants", { let array = list.split(/[\s\,]/gi).filter((s: string) => s.length > 0); for (let item of array) { - let t = new RegExp( - /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/ - ).test(item); + item = item.replace(/;/g, ""); // strip out semicolons + + let t = new RegExp(/^[\w\-\.]+@([\w-]+\.)+[\w-]{2,}$/g).test(item); if (t) results.valid.push(item); else results.invalid.push(item); } From a74260b2ded692f18a1d66ee957fe21fc744d404 Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Thu, 18 Apr 2024 10:47:16 -0700 Subject: [PATCH 4/4] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 158e49b..bc18904 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -2,7 +2,7 @@ name: Build and Push on: push: - branches: [ main ] + branches: [main, test] env: REGISTRY: ghcr.io @@ -22,9 +22,22 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Generate release tag + id: generate_release_tag + uses: amitsingh-007/next-release-tag@v4.0.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + tag_prefix: "v" + tag_template: "yyyy.mm.dd.i" + - name: Build and push Docker image uses: docker/build-push-action@v3 with: context: . push: true - tags: ghcr.io/${{ github.repository }}:latest + tags: ghcr.io/${{ github.repository }}:${{ steps.generate_release_tag.outputs.next_release_tag }} + + - name: Create release + uses: ncipollo/release-action@v1 + with: + tag: ${{ steps.generate_release_tag.outputs.next_release_tag }}