[mailer] include username in ban and inactivityWarning

This commit is contained in:
Andrea 2022-02-27 09:10:13 +01:00
parent f35290f51e
commit f50ae61a86
3 changed files with 4 additions and 2 deletions

View File

@ -48,7 +48,7 @@ async function warnInactive(db) {
if (userRefreshed.bannedReason !== null) { if (userRefreshed.bannedReason !== null) {
continue; continue;
} }
mailer(userRefreshed.email, 'inactivityWarning') mailer(userRefreshed.email, 'inactivityWarning', {username: userRefreshed.username});
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }

View File

@ -163,7 +163,7 @@ router.post('/admin/ban/:username', handleErrorAsync(async (req, res) => {
WHERE id = ${user.id} WHERE id = ${user.id}
`); `);
await archiveBan(req.db, user); await archiveBan(req.db, user);
mailer(user.email, 'ban', {reason: req.body.reason}); mailer(user.email, 'ban', {reason: req.body.reason, username: normalise(req.params.username)});
} else { } else {
await req.db.get(SQL` await req.db.get(SQL`
UPDATE users UPDATE users

View File

@ -72,6 +72,7 @@ const templates = {
<p>[[ban.header]]</p> <p>[[ban.header]]</p>
<p>[[ban.reason]][[quotation.colon]] %reason%</p> <p>[[ban.reason]][[quotation.colon]] %reason%</p>
<p style="font-size: 12px; color: #777">[[quotation.start]]${terms}[[quotation.end]]</p> <p style="font-size: 12px; color: #777">[[quotation.start]]${terms}[[quotation.end]]</p>
<p style="color: #999; font-size: 10px;">@{{username}}</p>
`, `,
}, },
inactivityWarning: { inactivityWarning: {
@ -84,6 +85,7 @@ const templates = {
[[user.removeInactive.email.cta]] [[user.removeInactive.email.cta]]
</a> </a>
</p> </p>
<p style="color: #999; font-size: 10px;">@{{username}}</p>
`, `,
}, },
cardsWarning: { cardsWarning: {