summaryrefslogtreecommitdiffstats
path: root/app/email_batching.go
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-06-30 16:06:59 +0800
committerGeorge Goldberg <george@gberg.me>2017-06-30 09:06:59 +0100
commiteea64f8049d90c5dcf14a739d640f5aa6a9c7add (patch)
treefabaa232bad7f4ebddf30b073c37a5962029f7fd /app/email_batching.go
parentfb57b3dd53eaca28a557ea7e334e9d7216ce6aab (diff)
downloadchat-eea64f8049d90c5dcf14a739d640f5aa6a9c7add.tar.gz
chat-eea64f8049d90c5dcf14a739d640f5aa6a9c7add.tar.bz2
chat-eea64f8049d90c5dcf14a739d640f5aa6a9c7add.zip
[PLT-5864] Move teammate name display setting to the System Console (#6681)
* move teammate name display setting to the system console * update all the likes of TeammateNameDisplay names * fix gofmt error * rebase and fix conflict
Diffstat (limited to 'app/email_batching.go')
-rw-r--r--app/email_batching.go16
1 files changed, 2 insertions, 14 deletions
diff --git a/app/email_batching.go b/app/email_batching.go
index 6d7a376ef..5e4a36daf 100644
--- a/app/email_batching.go
+++ b/app/email_batching.go
@@ -4,7 +4,6 @@
package app
import (
- "database/sql"
"fmt"
"html/template"
"strconv"
@@ -163,7 +162,6 @@ func (job *EmailBatchingJob) checkPendingNotifications(now time.Time, handler fu
func sendBatchedEmailNotification(userId string, notifications []*batchedNotification) {
uchan := Srv.Store.User().Get(userId)
- pchan := Srv.Store.Preference().Get(userId, model.PREFERENCE_CATEGORY_DISPLAY_SETTINGS, model.PREFERENCE_NAME_DISPLAY_NAME_FORMAT)
var user *model.User
if result := <-uchan; result.Err != nil {
@@ -174,17 +172,7 @@ func sendBatchedEmailNotification(userId string, notifications []*batchedNotific
}
translateFunc := utils.GetUserTranslations(user.Locale)
-
- var displayNameFormat string
- if result := <-pchan; result.Err != nil && result.Err.DetailedError != sql.ErrNoRows.Error() {
- l4g.Warn("api.email_batching.send_batched_email_notification.preferences.app_error")
- return
- } else if result.Err != nil {
- // no display name format saved, so fall back to default
- displayNameFormat = model.PREFERENCE_DEFAULT_DISPLAY_NAME_FORMAT
- } else {
- displayNameFormat = result.Data.(model.Preference).Value
- }
+ displayNameFormat := *utils.Cfg.TeamSettings.TeammateNameDisplay
var contents string
for _, notification := range notifications {
@@ -236,7 +224,7 @@ func renderBatchedPost(template *utils.HTMLTemplate, post *model.Post, teamName
l4g.Warn(utils.T("api.email_batching.render_batched_post.sender.app_error"))
return ""
} else {
- template.Props["SenderName"] = result.Data.(*model.User).GetDisplayNameForPreference(displayNameFormat)
+ template.Props["SenderName"] = result.Data.(*model.User).GetDisplayName(displayNameFormat)
}
if result := <-cchan; result.Err != nil {