summaryrefslogtreecommitdiffstats
path: root/app/import_functions.go
diff options
context:
space:
mode:
authorSimone Salsi <thedos@terminus.space>2018-10-08 18:01:27 +0200
committerGeorge Goldberg <george@gberg.me>2018-10-08 17:01:27 +0100
commitfe9a81208e4d8290df7b8d89bac2d880c045b84b (patch)
tree79db085e0447214d18dd145ec99eb67c50ff61c1 /app/import_functions.go
parent9a4f3ce1e5b22a297eeb00b2aaff44f88304ae8c (diff)
downloadchat-fe9a81208e4d8290df7b8d89bac2d880c045b84b.tar.gz
chat-fe9a81208e4d8290df7b8d89bac2d880c045b84b.tar.bz2
chat-fe9a81208e4d8290df7b8d89bac2d880c045b84b.zip
Added the changes requested for MM-8860: Bulk import email intervals (#8498) (#9578)
MM-8860: Bulk import email intervals (#8498)
Diffstat (limited to 'app/import_functions.go')
-rw-r--r--app/import_functions.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/import_functions.go b/app/import_functions.go
index bec215eec..81acf0380 100644
--- a/app/import_functions.go
+++ b/app/import_functions.go
@@ -581,6 +581,30 @@ func (a *App) ImportUser(data *UserImportData, dryRun bool) *model.AppError {
})
}
+ if data.EmailInterval != nil || savedUser.NotifyProps[model.EMAIL_NOTIFY_PROP] == "false" {
+ var intervalSeconds string
+ if value := savedUser.NotifyProps[model.EMAIL_NOTIFY_PROP]; value == "false" {
+ intervalSeconds = "0"
+ } else {
+ switch *data.EmailInterval {
+ case model.PREFERENCE_EMAIL_INTERVAL_IMMEDIATELY:
+ intervalSeconds = model.PREFERENCE_EMAIL_INTERVAL_NO_BATCHING_SECONDS
+ case model.PREFERENCE_EMAIL_INTERVAL_FIFTEEN:
+ intervalSeconds = model.PREFERENCE_EMAIL_INTERVAL_FIFTEEN_AS_SECONDS
+ case model.PREFERENCE_EMAIL_INTERVAL_HOUR:
+ intervalSeconds = model.PREFERENCE_EMAIL_INTERVAL_HOUR_AS_SECONDS
+ }
+ }
+ if intervalSeconds != "" {
+ preferences = append(preferences, model.Preference{
+ UserId: savedUser.Id,
+ Category: model.PREFERENCE_CATEGORY_NOTIFICATIONS,
+ Name: model.PREFERENCE_NAME_EMAIL_INTERVAL,
+ Value: intervalSeconds,
+ })
+ }
+ }
+
if len(preferences) > 0 {
if result := <-a.Srv.Store.Preference().Save(&preferences); result.Err != nil {
return model.NewAppError("BulkImport", "app.import.import_user.save_preferences.error", nil, result.Err.Error(), http.StatusInternalServerError)