From eea64f8049d90c5dcf14a739d640f5aa6a9c7add Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Fri, 30 Jun 2017 16:06:59 +0800 Subject: [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 --- app/email_batching.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'app/email_batching.go') 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 { -- cgit v1.2.3-1-g7c22