Fix blog posts losing their Created time on edit
This commit is contained in:
parent
e8ca2e408a
commit
3b3295884c
|
@ -469,7 +469,7 @@ func (b *Blog) EditBlog(w http.ResponseWriter, r *http.Request) {
|
||||||
var post *posts.Post
|
var post *posts.Post
|
||||||
|
|
||||||
// Are we editing an existing 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)
|
id, err := strconv.Atoi(idStr)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
post, err = posts.Load(id)
|
post, err = posts.Load(id)
|
||||||
|
@ -500,6 +500,8 @@ func (b *Blog) EditBlog(w http.ResponseWriter, r *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
author, _ := b.CurrentUser(r)
|
author, _ := b.CurrentUser(r)
|
||||||
post.AuthorID = author.ID
|
post.AuthorID = author.ID
|
||||||
|
|
||||||
|
post.Updated = time.Now().UTC()
|
||||||
err = post.Save()
|
err = post.Save()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
v.Error = err
|
v.Error = err
|
||||||
|
|
Loading…
Reference in New Issue
Block a user