From b8efeb2e72475378c7f58e1c8367f8b4da9b7efd Mon Sep 17 00:00:00 2001 From: Yi EungJun Date: Tue, 8 Dec 2015 12:23:38 +0900 Subject: [PATCH] Use local timezone for notification email Local timezone is better default than UTC because it is common that all users of a mattermost server live near the server. --- api/post.go | 4 ++-- api/templates/post_body.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/post.go b/api/post.go index ef70e1336c..ffb69f382d 100644 --- a/api/post.go +++ b/api/post.go @@ -465,8 +465,7 @@ func sendNotificationsAndForget(c *Context, post *model.Post, team *model.Team, teamURL := c.GetSiteURL() + "/" + team.Name // Build and send the emails - location, _ := time.LoadLocation("UTC") - tm := time.Unix(post.CreateAt/1000, 0).In(location) + tm := time.Unix(post.CreateAt/1000, 0) subjectPage := NewServerTemplatePage("post_subject") subjectPage.Props["SiteURL"] = c.GetSiteURL() @@ -498,6 +497,7 @@ func sendNotificationsAndForget(c *Context, post *model.Post, team *model.Team, bodyPage.Props["Minute"] = fmt.Sprintf("%02d", tm.Minute()) bodyPage.Props["Month"] = tm.Month().String()[:3] bodyPage.Props["Day"] = fmt.Sprintf("%d", tm.Day()) + bodyPage.Props["TimeZone"], _ = tm.Zone() bodyPage.Props["PostMessage"] = model.ClearMentionTags(post.Message) bodyPage.Props["TeamLink"] = teamURL + "/channels/" + channel.Name diff --git a/api/templates/post_body.html b/api/templates/post_body.html index 182134b1a5..00d4a563df 100644 --- a/api/templates/post_body.html +++ b/api/templates/post_body.html @@ -18,7 +18,7 @@

You were mentioned

-

CHANNEL: {{.Props.ChannelName}}
{{.Props.SenderName}} - {{.Props.Hour}}:{{.Props.Minute}} GMT, {{.Props.Month}} {{.Props.Day}}

{{.Props.PostMessage}}

+

CHANNEL: {{.Props.ChannelName}}
{{.Props.SenderName}} - {{.Props.Hour}}:{{.Props.Minute}} {{.Props.TimeZone}}, {{.Props.Month}} {{.Props.Day}}

{{.Props.PostMessage}}

Go To Channel