This commit is contained in:
parent
665d09214c
commit
7e2259658a
|
@ -465,6 +465,7 @@ export default function killTheNewsletter(
|
||||||
const subject = email.subject ?? "";
|
const subject = email.subject ?? "";
|
||||||
const body =
|
const body =
|
||||||
typeof email.html === "string" ? email.html : email.textAsHtml ?? "";
|
typeof email.html === "string" ? email.html : email.textAsHtml ?? "";
|
||||||
|
database.executeTransaction(() => {
|
||||||
for (const address of new Set(
|
for (const address of new Set(
|
||||||
session.envelope.rcptTo.map(
|
session.envelope.rcptTo.map(
|
||||||
(smtpServerAddress) => smtpServerAddress.address
|
(smtpServerAddress) => smtpServerAddress.address
|
||||||
|
@ -476,7 +477,6 @@ export default function killTheNewsletter(
|
||||||
sql`SELECT "id" FROM "feeds" WHERE "reference" = ${feedReference}`
|
sql`SELECT "id" FROM "feeds" WHERE "reference" = ${feedReference}`
|
||||||
);
|
);
|
||||||
if (feed === undefined) continue;
|
if (feed === undefined) continue;
|
||||||
database.executeTransaction(() => {
|
|
||||||
database.run(
|
database.run(
|
||||||
sql`
|
sql`
|
||||||
INSERT INTO "entries" ("feed", "title", "author", "content")
|
INSERT INTO "entries" ("feed", "title", "author", "content")
|
||||||
|
@ -487,8 +487,8 @@ export default function killTheNewsletter(
|
||||||
database.run(
|
database.run(
|
||||||
sql`DELETE FROM "entries" WHERE "feed" = ${feed.id} ORDER BY "createdAt" ASC LIMIT 1`
|
sql`DELETE FROM "entries" WHERE "feed" = ${feed.id} ORDER BY "createdAt" ASC LIMIT 1`
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
callback();
|
callback();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(
|
console.error(
|
||||||
|
|
Loading…
Reference in New Issue