Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
KenWilliamson committed Aug 30, 2023
1 parent ab62693 commit 1b2e0b4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
30 changes: 15 additions & 15 deletions handlers/blogHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,16 +323,16 @@ func (h *MCHandler) UpdateBlogPage(w http.ResponseWriter, r *http.Request) {
h.Log.Debug("blog id in edit", bid)
bg := h.Delegate.GetBlog(bid)

var bp BlogPage
bp.Title = h.Title
bp.Desc = h.Desc
bp.KeyWords = h.KeyWords
var ubp BlogPage
ubp.Title = h.Title
ubp.Desc = h.Desc
ubp.KeyWords = h.KeyWords
uemail := s.Get("userEmail")
if uemail != nil {
bp.MyEmail = uemail.(string)
ubp.MyEmail = uemail.(string)
}
var bb Blog
bb.Blog = bg
var ubb Blog
ubb.Blog = bg
txt, err := b64.StdEncoding.DecodeString(bg.Content)
if err == nil {
bg.Content = string(txt)
Expand All @@ -341,21 +341,21 @@ func (h *MCHandler) UpdateBlogPage(w http.ResponseWriter, r *http.Request) {
bg.Content = strings.Replace(bg.Content, stripOut3, "", -1)
bg.Content = strings.Replace(bg.Content, stripOut4, "", -1)

bb.TextHTML = template.HTML(bg.Content)
h.Log.Debug("TextHTML: ", bb.TextHTML)
ubb.TextHTML = template.HTML(bg.Content)
h.Log.Debug("TextHTML: ", ubb.TextHTML)
}

bp.Blog = &bb
ubp.Blog = &ubb

u1 := h.Delegate.GetUserByID(bb.Blog.UserID)
u1 := h.Delegate.GetUserByID(ubb.Blog.UserID)
h.Log.Debug("get user: ")

bb.User = u1
bb.UserImage = b64.StdEncoding.EncodeToString(bb.User.Image)
ubb.User = u1
ubb.UserImage = b64.StdEncoding.EncodeToString(ubb.User.Image)
h.Log.Debug("User Done: ")

if bp.Blog.User.Email == bp.MyEmail {
h.Templates.ExecuteTemplate(w, editBlogPage, &bp)
if ubp.Blog.User.Email == ubp.MyEmail {
h.Templates.ExecuteTemplate(w, editBlogPage, &ubp)
} else {
http.Redirect(w, r, indexRt, http.StatusFound)
}
Expand Down
4 changes: 2 additions & 2 deletions handlers/coverage.out
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ github.com/Ulbora/go-micro-blog-ui/handlers/blogHandler.go:319.27,331.21 11 1
github.com/Ulbora/go-micro-blog-ui/handlers/blogHandler.go:331.21,333.5 1 1
github.com/Ulbora/go-micro-blog-ui/handlers/blogHandler.go:334.4,337.18 4 1
github.com/Ulbora/go-micro-blog-ui/handlers/blogHandler.go:337.18,346.5 7 1
github.com/Ulbora/go-micro-blog-ui/handlers/blogHandler.go:348.4,357.40 7 1
github.com/Ulbora/go-micro-blog-ui/handlers/blogHandler.go:357.40,359.5 1 1
github.com/Ulbora/go-micro-blog-ui/handlers/blogHandler.go:348.4,357.42 7 1
github.com/Ulbora/go-micro-blog-ui/handlers/blogHandler.go:357.42,359.5 1 1
github.com/Ulbora/go-micro-blog-ui/handlers/blogHandler.go:359.10,361.5 1 1
github.com/Ulbora/go-micro-blog-ui/handlers/blogHandler.go:362.9,364.4 1 1
github.com/Ulbora/go-micro-blog-ui/handlers/blogHandler.go:369.72,377.9 8 1
Expand Down
Binary file modified main
Binary file not shown.

0 comments on commit 1b2e0b4

Please sign in to comment.