From 3b3295884c40d3b5d743c4a081e20e1e1029e7dd Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Fri, 9 Feb 2018 18:25:03 -0800 Subject: [PATCH] Fix blog posts losing their Created time on edit --- core/blog.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/blog.go b/core/blog.go index 9ca5ab3..94f2400 100644 --- a/core/blog.go +++ b/core/blog.go @@ -469,7 +469,7 @@ func (b *Blog) EditBlog(w http.ResponseWriter, r *http.Request) { var post *posts.Post // Are we editing an existing post? - if idStr := r.URL.Query().Get("id"); idStr != "" { + if idStr := r.FormValue("id"); idStr != "" { id, err := strconv.Atoi(idStr) if err == nil { post, err = posts.Load(id) @@ -500,6 +500,8 @@ func (b *Blog) EditBlog(w http.ResponseWriter, r *http.Request) { } else { author, _ := b.CurrentUser(r) post.AuthorID = author.ID + + post.Updated = time.Now().UTC() err = post.Save() if err != nil { v.Error = err