got display of advanced post control buttons to work, fixed topic name display and display of "new" messages with 0 new

This commit is contained in:
2026-01-14 23:00:40 -07:00
parent 01345e0d38
commit dd7b3d7858
4 changed files with 33 additions and 12 deletions
+4 -1
View File
@@ -489,7 +489,9 @@ func ReadPosts(ctxt ui.AmContext) (string, any, error) {
postRange[0] = lastRead + 1
postRange[1] = topic.TopMessage
count := postRange[1] - postRange[0] + 1
if count > ctxt.Globals().PostsPerPage {
if count == 0 {
postRange[0] = max(postRange[1]-ctxt.Globals().PostsPerPage+1, 0)
} else if count > ctxt.Globals().PostsPerPage {
postRange[0] = postRange[1] - ctxt.Globals().PostsPerPage + 1
} else if count < ctxt.Globals().PostsPerPage {
pin = postRange[0] - 1
@@ -525,6 +527,7 @@ func ReadPosts(ctxt ui.AmContext) (string, any, error) {
ctxt.VarMap().Set("pseud", pseud)
// Render the output.
ctxt.VarMap().Set("advancedControls", ctxt.HasParameter("ac") && len(posts) == 1)
ctxt.VarMap().Set("amsterdam_pageTitle", fmt.Sprintf("%s: %s", topic.Name, summaryLine))
ctxt.VarMap().Set("topicName", topic.Name)
ctxt.VarMap().Set("summaryLine", summaryLine)