Add config to disable it
This commit is contained in:
parent
7c1836f188
commit
1ff0167f1a
|
@ -39,6 +39,9 @@ service:
|
|||
# each request made to this endpoint neefs to provide an `Authorization: <token>` header with the token from below. <br/>
|
||||
# **You should never use this unless you know exactly what you're doing**
|
||||
testingtoken: ''
|
||||
# If enabled, vikunja will send an email to everyone who is either assigned to a task or created it when a task reminder
|
||||
# is due.
|
||||
enableemailreminders: true
|
||||
|
||||
database:
|
||||
# Database type to use. Supported types are mysql, postgres and sqlite.
|
||||
|
|
|
@ -170,6 +170,13 @@ each request made to this endpoint neefs to provide an `Authorization: <token>`
|
|||
|
||||
Default: `<empty>`
|
||||
|
||||
### enableemailreminders
|
||||
|
||||
If enabled, vikunja will send an email to everyone who is either assigned to a task or created it when a task reminder
|
||||
is due.
|
||||
|
||||
Default: `true`
|
||||
|
||||
---
|
||||
|
||||
## database
|
||||
|
|
|
@ -52,6 +52,7 @@ const (
|
|||
ServiceEnableTotp Key = `service.enabletotp`
|
||||
ServiceSentryDsn Key = `service.sentrydsn`
|
||||
ServiceTestingtoken Key = `service.testingtoken`
|
||||
ServiceEnableEmailReminders Key = `service.enableemailreminders`
|
||||
|
||||
AuthLocalEnabled Key = `auth.local.enabled`
|
||||
AuthOpenIDEnabled Key = `auth.openid.enabled`
|
||||
|
@ -233,6 +234,7 @@ func InitDefaultConfig() {
|
|||
ServiceTimeZone.setDefault("GMT")
|
||||
ServiceEnableTaskComments.setDefault(true)
|
||||
ServiceEnableTotp.setDefault(true)
|
||||
ServiceEnableEmailReminders.setDefault(false)
|
||||
|
||||
// Auth
|
||||
AuthLocalEnabled.setDefault(true)
|
||||
|
|
|
@ -87,6 +87,10 @@ func getTaskUsersForTasks(taskIDs []int64) (taskUsers []*taskUser, err error) {
|
|||
// RegisterReminderCron registers a cron function which runs every minute to check if any reminders are due the
|
||||
// next minute to send emails.
|
||||
func RegisterReminderCron() {
|
||||
if !config.ServiceEnableEmailReminders.GetBool() {
|
||||
return
|
||||
}
|
||||
|
||||
if !config.MailerEnabled.GetBool() {
|
||||
log.Info("Mailer is disabled, not sending reminders per mail")
|
||||
return
|
||||
|
@ -140,7 +144,6 @@ func RegisterReminderCron() {
|
|||
mail.SendMailWithTemplate(u.User.Email, `Reminder for "`+u.Task.Title+`"`, "reminder-email", data)
|
||||
log.Debugf("[Task Reminder Cron] Sent reminder email for task %d to user %d", u.Task.ID, u.User.ID)
|
||||
}
|
||||
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("Could not register reminder cron: %s", err)
|
||||
|
|
Loading…
Reference in New Issue