mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
fix: use bcc for admin emails, fix #371
This commit is contained in:
parent
80efc69946
commit
4ba5645ebf
3 changed files with 6 additions and 6 deletions
|
@ -306,7 +306,7 @@ const eventController = {
|
||||||
log.info('[EVENT] Report event to %s', emails)
|
log.info('[EVENT] Report event to %s', emails)
|
||||||
|
|
||||||
// notify admins
|
// notify admins
|
||||||
mail.send(emails, 'report', { event, message: body.message, author })
|
mail.send(emails, 'report', { event, message: body.message, author }, undefined, true)
|
||||||
|
|
||||||
// notify author
|
// notify author
|
||||||
if (event['user.email'] && body.is_author_visible && !isMine) {
|
if (event['user.email'] && body.is_author_visible && !isMine) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ const { Task, TaskManager } = require('../taskManager')
|
||||||
const locales = require('../../locales')
|
const locales = require('../../locales')
|
||||||
|
|
||||||
const mail = {
|
const mail = {
|
||||||
send (addresses, template, locals, locale) {
|
send (addresses, template, locals, locale, bcc) {
|
||||||
locale = locale || settingsController.settings.instance_locale
|
locale = locale || settingsController.settings.instance_locale
|
||||||
if (process.env.NODE_ENV === 'production' && (!settingsController.settings.admin_email || !settingsController.settings.smtp)) {
|
if (process.env.NODE_ENV === 'production' && (!settingsController.settings.admin_email || !settingsController.settings.smtp)) {
|
||||||
log.error(`Cannot send any email: SMTP Email configuration not completed!`)
|
log.error(`Cannot send any email: SMTP Email configuration not completed!`)
|
||||||
|
@ -17,12 +17,12 @@ const mail = {
|
||||||
const task = new Task({
|
const task = new Task({
|
||||||
name: 'MAIL',
|
name: 'MAIL',
|
||||||
method: mail._send,
|
method: mail._send,
|
||||||
args: [addresses, template, locals, locale]
|
args: [addresses, template, locals, locale, bcc]
|
||||||
})
|
})
|
||||||
TaskManager.add(task)
|
TaskManager.add(task)
|
||||||
},
|
},
|
||||||
|
|
||||||
_send (addresses, template, locals, locale) {
|
_send (addresses, template, locals, locale, bcc=false) {
|
||||||
locale = locale || settingsController.settings.instance_locale
|
locale = locale || settingsController.settings.instance_locale
|
||||||
const settings = settingsController.settings
|
const settings = settingsController.settings
|
||||||
log.info(`Send ${template} email to ${addresses} with locale ${locale}`)
|
log.info(`Send ${template} email to ${addresses} with locale ${locale}`)
|
||||||
|
@ -61,7 +61,7 @@ const mail = {
|
||||||
const msg = {
|
const msg = {
|
||||||
template,
|
template,
|
||||||
message: {
|
message: {
|
||||||
to: addresses
|
[bcc ? 'bcc' : 'to']: addresses
|
||||||
},
|
},
|
||||||
locals: {
|
locals: {
|
||||||
...locals,
|
...locals,
|
||||||
|
|
|
@ -26,7 +26,7 @@ const notifier = {
|
||||||
let emails = [settingsController.settings.admin_email]
|
let emails = [settingsController.settings.admin_email]
|
||||||
emails = emails.concat(admins?.map(a => a.email))
|
emails = emails.concat(admins?.map(a => a.email))
|
||||||
p = mail.send(emails, 'event',
|
p = mail.send(emails, 'event',
|
||||||
{ event, to_confirm: !event.is_visible, notification })
|
{ event, to_confirm: !event.is_visible, notification }, undefined, true)
|
||||||
promises.push(p)
|
promises.push(p)
|
||||||
break
|
break
|
||||||
case 'ap':
|
case 'ap':
|
||||||
|
|
Loading…
Reference in a new issue