fixed showing of hidden posts
This commit is contained in:
+8
-4
@@ -385,7 +385,8 @@ func templatePostText(args jet.Arguments) reflect.Value {
|
||||
// templateOverrideLine creates the "override line" for a post, that is, what gets displayed in place of the post text.
|
||||
func templateOverrideLine(args jet.Arguments) reflect.Value {
|
||||
post := args.Get(0).Convert(reflect.TypeFor[*database.PostHeader]()).Interface().(*database.PostHeader)
|
||||
ctxt := args.Get(1).Convert(reflect.TypeFor[ui.AmContext]()).Interface().(ui.AmContext)
|
||||
advanced := args.Get(1).Convert(reflect.TypeFor[bool]()).Bool()
|
||||
ctxt := args.Get(2).Convert(reflect.TypeFor[ui.AmContext]()).Interface().(ui.AmContext)
|
||||
rc := ""
|
||||
if post.IsScribbled() {
|
||||
scr_date := ""
|
||||
@@ -402,7 +403,7 @@ func templateOverrideLine(args jet.Arguments) reflect.Value {
|
||||
} else {
|
||||
rc = fmt.Sprintf("<<<%v>>>", err)
|
||||
}
|
||||
} else if post.Hidden {
|
||||
} else if post.Hidden && !advanced {
|
||||
rc = fmt.Sprintf("(Hidden Message: %d Lines)", *post.LineCount)
|
||||
}
|
||||
return reflect.ValueOf(rc)
|
||||
@@ -411,9 +412,10 @@ func templateOverrideLine(args jet.Arguments) reflect.Value {
|
||||
// templateOverrideLink creates the "override link" for a post, which can make the override line a hyperlink.
|
||||
func templateOverrideLink(args jet.Arguments) reflect.Value {
|
||||
post := args.Get(0).Convert(reflect.TypeFor[*database.PostHeader]()).Interface().(*database.PostHeader)
|
||||
root := args.Get(1).Convert(reflect.TypeFor[string]()).String()
|
||||
advanced := args.Get(1).Convert(reflect.TypeFor[bool]()).Bool()
|
||||
root := args.Get(2).Convert(reflect.TypeFor[string]()).String()
|
||||
rc := ""
|
||||
if post.Hidden {
|
||||
if post.Hidden && !advanced {
|
||||
rc = fmt.Sprintf("%s?r=%d&ac=1", root, post.Num)
|
||||
}
|
||||
return reflect.ValueOf(rc)
|
||||
@@ -564,6 +566,7 @@ func ReadPosts(ctxt ui.AmContext) (string, any) {
|
||||
ctxt.VarMap().Set("post_confRef", plc.AsString())
|
||||
plc.Community = comm.Alias
|
||||
ctxt.VarMap().Set("post_topicPermalink", fmt.Sprintf("/go/%s", plc.AsString()))
|
||||
ctxt.VarMap().Set("post_topicLink", fmt.Sprintf("%s/r/%d", ctxt.GetScratch("ConferenceLink"), topic.Number))
|
||||
plc.FirstPost = postRange[0]
|
||||
plc.LastPost = postRange[1]
|
||||
ctxt.VarMap().Set("postsPermalink", fmt.Sprintf("/go/%s", plc.AsString()))
|
||||
@@ -776,6 +779,7 @@ func PostInTopic(ctxt ui.AmContext) (string, any) {
|
||||
ctxt.VarMap().Set("post_confRef", plc.AsString())
|
||||
plc.Community = comm.Alias
|
||||
ctxt.VarMap().Set("post_topicPermalink", fmt.Sprintf("/go/%s", plc.AsString()))
|
||||
ctxt.VarMap().Set("post_topicLink", fmt.Sprintf("%s/r/%d", ctxt.GetScratch("ConferenceLink"), topic.Number))
|
||||
|
||||
ctxt.VarMap().SetFunc("post_getOverrideLine", templateOverrideLine)
|
||||
ctxt.VarMap().SetFunc("post_getOverrideLink", templateOverrideLink)
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.erbosoft.com/amy/amsterdam/config"
|
||||
"git.erbosoft.com/amy/amsterdam/database"
|
||||
@@ -82,6 +83,10 @@ func SetCommunity(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
if err != nil {
|
||||
return AmSendPageData(c, ctxt, "error", echo.NewHTTPError(http.StatusNotFound).SetInternal(err))
|
||||
}
|
||||
var b strings.Builder
|
||||
b.WriteString("/comm/")
|
||||
b.WriteString(ctxt.CurrentCommunity().Alias)
|
||||
ctxt.SetScratch("CommunityLink", b.String())
|
||||
ctxt.SetLeftMenu("community")
|
||||
return next(c)
|
||||
}
|
||||
@@ -128,6 +133,11 @@ func SetConference(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
ctxt.SetScratch("currentConference", conf)
|
||||
ctxt.SetScratch("currentAlias", ctxt.URLParam("confid"))
|
||||
ctxt.SetScratch("levelInConference", myLevel)
|
||||
var b strings.Builder
|
||||
b.WriteString(ctxt.GetScratch("CommunityLink").(string))
|
||||
b.WriteString("/conf/")
|
||||
b.WriteString(ctxt.URLParam("confid"))
|
||||
ctxt.SetScratch("ConferenceLink", b.String())
|
||||
return next(c)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -117,8 +117,8 @@
|
||||
{{ post_cur = p }}
|
||||
{{ post_userName = post_getUserName(p, .) }}
|
||||
{{ post_text = post_getText(p, .) }}
|
||||
{{ post_overrideLine = post_getOverrideLine(p, .) }}
|
||||
{{ post_overrideLink = post_getOverrideLink(p, post_topicPermalink) }}
|
||||
{{ post_overrideLine = post_getOverrideLine(p, advancedControls, .) }}
|
||||
{{ post_overrideLink = post_getOverrideLink(p, advancedControls, post_topicLink) }}
|
||||
{{ post_attach = post_getAttachmentInfo(p, .) }}
|
||||
{{ post_bozo = post_isBozo(p, post_topic, .) }}
|
||||
{{ if showPics }}
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
{{ post_cur = p }}
|
||||
{{ post_userName = post_getUserName(p, .) }}
|
||||
{{ post_text = post_getText(p, .) }}
|
||||
{{ post_overrideLine = post_getOverrideLine(p, .) }}
|
||||
{{ post_overrideLink = post_getOverrideLink(p, post_topicPermalink) }}
|
||||
{{ post_overrideLine = post_getOverrideLine(p, true, .) }}
|
||||
{{ post_overrideLink = post_getOverrideLink(p, true, post_topicLink) }}
|
||||
{{ post_attach = post_getAttachmentInfo(p, .) }}
|
||||
{{ post_bozo = post_isBozo(p, post_topic, .) }}
|
||||
{{ include "singlepost.jet" }}
|
||||
|
||||
Reference in New Issue
Block a user