fix pre comment render
This commit is contained in:
parent
ceffeccf8d
commit
f257a966e6
|
@ -23,7 +23,11 @@ func configs(h *wp.Handle) {
|
|||
})
|
||||
wp.InitPipe(h)
|
||||
h.PushHandler(constraints.PipeMiddleware, constraints.Home,
|
||||
wp.NewHandleFn(widget.CheckCategory, 100, "widget.CheckCategory"))
|
||||
wp.NewHandleFn(widget.CheckCategory, 100, "widget.CheckCategory"),
|
||||
)
|
||||
h.PushHandler(constraints.PipeMiddleware, constraints.Detail,
|
||||
wp.NewHandleFn(wp.ShowPreComment, 100, "wp.ShowPreComment"),
|
||||
)
|
||||
|
||||
h.Index.SetPageEle(plugins.TwentyFifteenPagination())
|
||||
h.PushCacheGroupHeadScript(constraints.AllScene, "CalCustomBackGround", 10.005, CalCustomBackGround)
|
||||
|
|
|
@ -38,6 +38,9 @@ func configs(h *wp.Handle) {
|
|||
wp.InitPipe(h)
|
||||
h.PushHandler(constraints.PipeMiddleware, constraints.Home,
|
||||
wp.NewHandleFn(widget.CheckCategory, 100.006, "widget.CheckCategory"))
|
||||
h.PushHandler(constraints.PipeMiddleware, constraints.Detail,
|
||||
wp.NewHandleFn(wp.ShowPreComment, 100, "wp.ShowPreComment"),
|
||||
)
|
||||
h.AddActionFilter("bodyClass", calClass)
|
||||
h.PushCacheGroupHeadScript(constraints.AllScene, "colorScheme-customHeader", 10, colorScheme, customHeader)
|
||||
components.WidgetArea(h)
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"github.com/fthvgb1/wp-go/app/plugins/wpposts"
|
||||
"github.com/fthvgb1/wp-go/app/wpconfig"
|
||||
str "github.com/fthvgb1/wp-go/helper/strings"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type DetailHandle struct {
|
||||
|
@ -35,6 +36,16 @@ func (d *DetailHandle) BuildDetailData() (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func ShowPreComment(h *Handle) {
|
||||
v, ok := cache.NewCommentCache().Get(h.C, h.C.Request.URL.RawQuery)
|
||||
if ok {
|
||||
h.C.Writer.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
h.C.Writer.WriteHeader(http.StatusOK)
|
||||
_, _ = h.C.Writer.Write([]byte(v))
|
||||
h.Abort()
|
||||
}
|
||||
}
|
||||
|
||||
func (d *DetailHandle) CheckAndGetPost() (err error) {
|
||||
id := str.ToInteger[uint64](d.C.Param("id"), 0)
|
||||
maxId, err := cache.GetMaxPostId(d.C)
|
||||
|
|
Loading…
Reference in New Issue
Block a user