mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 17:59:25 +00:00
Don't block main thread waiting for email to build and send
This commit is contained in:
@@ -139,17 +139,18 @@ class TestTemplate {
|
||||
|
||||
const t = await new Test(this.#conn, id);
|
||||
|
||||
const email = (await EmailBuilder.generateFromClass(c))
|
||||
.setSubject('Stratos - New Test')
|
||||
.setBody(
|
||||
`New test added for class ${c.name}:\n` +
|
||||
`Test name: ${this.name}\n` +
|
||||
`Test date: ${t.getDateString()}\n` +
|
||||
`Maximum mark: ${this.maxMark}`
|
||||
);
|
||||
const body = `New test added for class ${c.name}:\n` +
|
||||
`Test name: ${this.name}\n` +
|
||||
`Test date: ${t.getDateString()}\n` +
|
||||
`Maximum mark: ${this.maxMark}`;
|
||||
|
||||
const emailer = new Emailer();
|
||||
await emailer.sendEmail(email);
|
||||
EmailBuilder.generateFromClass(c).then(email => {
|
||||
email.setSubject('Stratos - New Test')
|
||||
.setBody(body);
|
||||
|
||||
const emailer = new Emailer();
|
||||
emailer.sendEmail(email);
|
||||
});
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user