summaryrefslogtreecommitdiff
path: root/system/admin/handlers.go
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-01-12 15:14:52 -0800
committerSteve Manuel <nilslice@gmail.com>2017-01-12 15:14:52 -0800
commit60734aa72927ec262bba07e802227ab48e921443 (patch)
treeae2daa698e8f27851047ed0bf42bb70c72f1a737 /system/admin/handlers.go
parentc9137cfa590a73e32eef4e87d6d3b23e8e02f2c8 (diff)
adding fix for pending content being saved but not updated in db
Diffstat (limited to 'system/admin/handlers.go')
-rw-r--r--system/admin/handlers.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/system/admin/handlers.go b/system/admin/handlers.go
index 707814a..c39fee4 100644
--- a/system/admin/handlers.go
+++ b/system/admin/handlers.go
@@ -1580,11 +1580,12 @@ func editHandler(res http.ResponseWriter, req *http.Request) {
req.PostForm.Del(discardKey)
}
+ pt := t
if strings.Contains(t, "__") {
- t = strings.Split(t, "__")[0]
+ pt = strings.Split(t, "__")[0]
}
- p, ok := item.Types[t]
+ p, ok := item.Types[pt]
if !ok {
log.Println("Type", t, "is not a content type. Cannot edit or save.")
res.WriteHeader(http.StatusBadRequest)
@@ -1600,7 +1601,7 @@ func editHandler(res http.ResponseWriter, req *http.Request) {
post := p()
hook, ok := post.(item.Hookable)
if !ok {
- log.Println("Type", t, "does not implement item.Hookable or embed item.Item.")
+ log.Println("Type", pt, "does not implement item.Hookable or embed item.Item.")
res.WriteHeader(http.StatusBadRequest)
errView, err := Error400()
if err != nil {
@@ -1658,7 +1659,7 @@ func editHandler(res http.ResponseWriter, req *http.Request) {
host := req.URL.Host
path := req.URL.Path
sid := fmt.Sprintf("%d", id)
- redir := scheme + host + path + "?type=" + t + "&id=" + sid
+ redir := scheme + host + path + "?type=" + pt + "&id=" + sid
if req.URL.Query().Get("status") == "pending" {
redir += "&status=pending"