From 9a88eb23e74c8b853dc8cfbb40c02c9c701b52de Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Wed, 2 Nov 2016 01:27:48 -0700 Subject: adding post unmarshal into cases based on status --- system/admin/handlers.go | 54 ++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/system/admin/handlers.go b/system/admin/handlers.go index 6c4cd83..f1e17e8 100644 --- a/system/admin/handlers.go +++ b/system/admin/handlers.go @@ -673,6 +673,20 @@ func postsHandler(res http.ResponseWriter, req *http.Request) { Pending ` + for i := range posts { + err := json.Unmarshal(posts[i], &p) + if err != nil { + log.Println("Error unmarshal json into", t, err, posts[i]) + + post := `
  • Error decoding data. Possible file corruption.
  • ` + b.Write([]byte(post)) + continue + } + + post := adminPostListItem(p, t, status) + b.Write(post) + } + case "pending": // get _pending posts of type t from the db posts = db.Query(t+"_pending", opts) @@ -683,42 +697,24 @@ func postsHandler(res http.ResponseWriter, req *http.Request) {  |  Pending ` - } - } - html += `