PLT-7375: Send batched emails if batching is enabled and user has not explicitly set their email interval preference

This commit is contained in:
Jonathan Fritz
2017-08-14 15:30:09 -04:00
parent 4cf316fcd3
commit 10dcdeca4b
2 changed files with 10 additions and 9 deletions
+2 -2
View File
@@ -333,8 +333,8 @@ func sendNotificationEmail(post *model.Post, user *model.User, channel *model.Ch
if *utils.Cfg.EmailSettings.EnableEmailBatching {
var sendBatched bool
if result := <-Srv.Store.Preference().Get(user.Id, model.PREFERENCE_CATEGORY_NOTIFICATIONS, model.PREFERENCE_NAME_EMAIL_INTERVAL); result.Err != nil {
// if the call fails, assume it hasn't been set and don't batch notifications for this user
sendBatched = false
// if the call fails, assume that the interval has not been explicitly set and batch the notifications
sendBatched = true
} else {
// if the user has chosen to receive notifications immediately, don't batch them
sendBatched = result.Data.(model.Preference).Value != model.PREFERENCE_EMAIL_INTERVAL_NO_BATCHING_SECONDS
+8 -7
View File
@@ -77,13 +77,13 @@
},
"SqlSettings": {
"DriverName": "mysql",
"DataSource": "mmuser:mostest@tcp(dockerhost:3306)/mattermost_test?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s",
"DataSource": "mmuser:mostest@tcp(dockerhost:3306)/mattermost_test?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s",
"DataSourceReplicas": [],
"DataSourceSearchReplicas": [],
"MaxIdleConns": 20,
"MaxOpenConns": 300,
"Trace": false,
"AtRestEncryptKey": "",
"AtRestEncryptKey": "mp7na5x1miithou7kzxxffw75757n8i6",
"QueryTimeout": 30
},
"LogSettings": {
@@ -111,7 +111,7 @@
"DriverName": "local",
"Directory": "./data/",
"EnablePublicLink": false,
"PublicLinkSalt": "",
"PublicLinkSalt": "kresho3jxyunrtphn8ioh1cspq7x9xdo",
"InitialFont": "luximbi.ttf",
"AmazonS3AccessKeyId": "",
"AmazonS3SecretAccessKey": "",
@@ -119,7 +119,8 @@
"AmazonS3Region": "us-east-1",
"AmazonS3Endpoint": "s3.amazonaws.com",
"AmazonS3SSL": true,
"AmazonS3SignV2": false
"AmazonS3SignV2": false,
"AmazonS3SSE": false
},
"EmailSettings": {
"EnableSignUpWithEmail": true,
@@ -136,11 +137,11 @@
"SMTPServer": "dockerhost",
"SMTPPort": "2500",
"ConnectionSecurity": "",
"InviteSalt": "",
"InviteSalt": "qey337qy64yhbshqy8p9ed9wk6ohs39t",
"SendPushNotifications": false,
"PushNotificationServer": "",
"PushNotificationContents": "generic",
"EnableEmailBatching": false,
"EnableEmailBatching": true,
"EmailBatchingBufferSize": 256,
"EmailBatchingInterval": 30,
"SkipServerCertificateVerification": false,
@@ -307,4 +308,4 @@
"PluginSettings": {
"Plugins": {}
}
}
}