-
Couldn't load subscription status.
- Fork 32
feat: email actions improvements #2281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,14 +23,7 @@ import { InstrumentsModule } from "./instruments/instruments.module"; | |
| import { MailerModule } from "@nestjs-modules/mailer"; | ||
| import { join } from "path"; | ||
| import { HandlebarsAdapter } from "@nestjs-modules/mailer/dist/adapters/handlebars.adapter"; | ||
| import { | ||
| formatCamelCase, | ||
| unwrapJSON, | ||
| jsonify, | ||
| job_v3, | ||
| urlencode, | ||
| base64enc, | ||
| } from "./common/handlebars-helpers"; | ||
| import { handlebarsHelpers } from "./common/handlebars-helpers"; | ||
| import { CommonModule } from "./common/common.module"; | ||
| import { RabbitMQModule } from "./common/rabbitmq/rabbitmq.module"; | ||
| import { EventEmitterModule } from "@nestjs/event-emitter"; | ||
|
|
@@ -131,15 +124,7 @@ import { MaskSensitiveDataInterceptorModule } from "./common/interceptors/mask-s | |
| }, | ||
| template: { | ||
| dir: join(__dirname, "./common/email-templates"), | ||
| adapter: new HandlebarsAdapter({ | ||
| unwrapJSON: unwrapJSON, | ||
| keyToWord: formatCamelCase, | ||
| eq: (a, b) => a === b, | ||
| jsonify: jsonify, | ||
| job_v3: job_v3, | ||
| urlencode: urlencode, | ||
| base64enc: base64enc, | ||
| }), | ||
| adapter: new HandlebarsAdapter(handlebarsHelpers), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for a later PR maybe, should we move the content of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. It is getting rather long. It might make sense to wrap handlebars too. Currently you need to remember to register helpers if you call hb directly from outside of a module (eg during testing). |
||
| options: { | ||
| strict: true, | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| {{!-- This is a minimal template used for testing email templating. --}} | ||
| Your {{job.type}} job with ID {{job.id}} has been completed successfully. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing | ||
|
|
||
| exports[`Email Template job-template-simplified.html should render correctly 1`] = ` | ||
| "<html> | ||
| <head> | ||
| <style type="text/css"> | ||
| body { | ||
| font-family: Helvetica, sans-serif; | ||
| background: #f0f0f0; | ||
| margin: 1em; | ||
| } | ||
|
|
||
| .container { | ||
| margin: auto; | ||
| max-width: 50em; | ||
| background: white; | ||
| padding: 2em; | ||
| box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), | ||
| 0px 2px 2px 0px rgba(0, 0, 0, 0.14), | ||
| 0px 1px 5px 0px rgba(0, 0, 0, 0.12); | ||
| } | ||
| .job-id-container { | ||
| padding: 1em 0; | ||
| } | ||
| .footer { | ||
| font-size: 0.8em; | ||
| color: #666; | ||
| font-style: italic; | ||
| padding-top: 2em; | ||
| } | ||
| .link { | ||
| text-decoration: none; | ||
| color: #de9300; | ||
| } | ||
| .link:hover { | ||
| color: #fea901; | ||
| } | ||
|
|
||
| table { | ||
| border-collapse: collapse; | ||
| border-spacing: 10px; | ||
|
|
||
| tr { | ||
| border-top: 1px solid #eee; | ||
| } | ||
| td { | ||
| padding: 0.5em; | ||
| } | ||
|
|
||
| .key{ | ||
| font-weight: bold; | ||
| color: #666; | ||
| vertical-align: top; | ||
| margin-top: 0; | ||
| } | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class="container"> | ||
| <div> | ||
| Your archive job has been submitted. It currently has status "jobStarted". | ||
| </div> | ||
| <div class="job-id-container"> | ||
| <b>Job id:</b> jobId123 | ||
| </div> | ||
| <p><b>The job will be perfomed on the following dataset(s):</b></p> | ||
| <table> | ||
| <tr style="background-color: lightblue;"> | ||
| <td class="key"> | ||
| testPid | ||
| </td> | ||
| </tr> | ||
| </table> | ||
|
|
||
| <div class="footer"> | ||
| This email was automatically generated by | ||
| <a class="link" href="https://scicatproject.github.io/">SciCat</a>. | ||
| Please do not reply. | ||
| </div> | ||
| </div> | ||
| </body> | ||
| </html>" | ||
| `; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be added to jobConfig.recommended.yaml as well, since sending email is such a common task?