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