diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/admin.go | 1 | ||||
-rw-r--r-- | api/channel.go | 2 | ||||
-rw-r--r-- | api/context.go | 4 | ||||
-rw-r--r-- | api/post.go | 1 | ||||
-rw-r--r-- | api/team.go | 1 | ||||
-rw-r--r-- | api/templates/email_change_body.html | 2 | ||||
-rw-r--r-- | api/user.go | 7 |
7 files changed, 9 insertions, 9 deletions
diff --git a/api/admin.go b/api/admin.go index e8cb8b3c7..d04991353 100644 --- a/api/admin.go +++ b/api/admin.go @@ -120,6 +120,7 @@ func getConfig(c *Context, w http.ResponseWriter, r *http.Request) { cfg := model.ConfigFromJson(strings.NewReader(json)) json = cfg.ToJson() + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") w.Write([]byte(json)) } diff --git a/api/channel.go b/api/channel.go index ff5b0f8da..e97e08fc0 100644 --- a/api/channel.go +++ b/api/channel.go @@ -729,7 +729,6 @@ func getChannel(c *Context, w http.ResponseWriter, r *http.Request) { return } else { w.Header().Set(model.HEADER_ETAG_SERVER, data.Etag()) - w.Header().Set("Expires", "-1") w.Write([]byte(data.ToJson())) } } @@ -798,7 +797,6 @@ func getChannelExtraInfo(c *Context, w http.ResponseWriter, r *http.Request) { data := model.ChannelExtra{Id: channel.Id, Members: extraMembers, MemberCount: memberCount} w.Header().Set(model.HEADER_ETAG_SERVER, extraEtag) - w.Header().Set("Expires", "-1") w.Write([]byte(data.ToJson())) } } diff --git a/api/context.go b/api/context.go index b91981ecd..d0b4f85d2 100644 --- a/api/context.go +++ b/api/context.go @@ -165,6 +165,10 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } else { // All api response bodies will be JSON formatted by default w.Header().Set("Content-Type", "application/json") + + if r.Method == "GET" { + w.Header().Set("Expires", "0") + } } if len(token) != 0 { diff --git a/api/post.go b/api/post.go index fadabd66e..9d3ba5ab1 100644 --- a/api/post.go +++ b/api/post.go @@ -1197,6 +1197,5 @@ func searchPosts(c *Context, w http.ResponseWriter, r *http.Request) { } w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") - w.Header().Set("Expires", "0") w.Write([]byte(posts.ToJson())) } diff --git a/api/team.go b/api/team.go index 6d59e94e9..052d6e698 100644 --- a/api/team.go +++ b/api/team.go @@ -647,7 +647,6 @@ func getMyTeam(c *Context, w http.ResponseWriter, r *http.Request) { return } else { w.Header().Set(model.HEADER_ETAG_SERVER, result.Data.(*model.Team).Etag()) - w.Header().Set("Expires", "-1") w.Write([]byte(result.Data.(*model.Team).ToJson())) return } diff --git a/api/templates/email_change_body.html b/api/templates/email_change_body.html index 4f28584c4..41b1bcd7d 100644 --- a/api/templates/email_change_body.html +++ b/api/templates/email_change_body.html @@ -18,7 +18,7 @@ <tr> <td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;"> <h2 style="font-weight: normal; margin-top: 10px;">{{.Props.Title}}</h2> - <p>{{.Props.Info}}</p> + <p>{{.Html.Info}}</p> </td> </tr> <tr> diff --git a/api/user.go b/api/user.go index 8f381aeda..7919da168 100644 --- a/api/user.go +++ b/api/user.go @@ -897,7 +897,6 @@ func getMe(c *Context, w http.ResponseWriter, r *http.Request) { } else { result.Data.(*model.User).Sanitize(map[string]bool{}) w.Header().Set(model.HEADER_ETAG_SERVER, result.Data.(*model.User).Etag()) - w.Header().Set("Expires", "-1") w.Write([]byte(result.Data.(*model.User).ToJson())) return } @@ -1761,14 +1760,14 @@ func sendEmailChangeEmailAndForget(c *Context, oldEmail, newEmail, teamDisplayNa go func() { subjectPage := NewServerTemplatePage("email_change_subject", c.Locale) - subjectPage.Props["Subject"] = c.T("api.templates.email_change_body", + subjectPage.Props["Subject"] = c.T("api.templates.email_change_subject", map[string]interface{}{"TeamDisplayName": teamDisplayName}) bodyPage := NewServerTemplatePage("email_change_body", c.Locale) bodyPage.Props["SiteURL"] = siteURL bodyPage.Props["Title"] = c.T("api.templates.email_change_body.title") - bodyPage.Props["Info"] = c.T("api.templates.email_change_body.info", - map[string]interface{}{"TeamDisplayName": teamDisplayName, "NewEmail": newEmail}) + bodyPage.Html["Info"] = template.HTML(c.T("api.templates.email_change_body.info", + map[string]interface{}{"TeamDisplayName": teamDisplayName, "NewEmail": newEmail})) if err := utils.SendMail(oldEmail, subjectPage.Render(), bodyPage.Render()); err != nil { l4g.Error(utils.T("api.user.send_email_change_email_and_forget.error"), err) |