added the Manage Topic page and strengthened some link conditions for anonymous user

This commit is contained in:
2026-01-28 15:19:18 -07:00
parent ead2b37f08
commit 928a19d600
8 changed files with 137 additions and 21 deletions
+30
View File
@@ -238,3 +238,33 @@ func HideMessage(ctxt ui.AmContext) (string, any, error) {
}
return "redirect", fmt.Sprintf("/comm/%s/conf/%s/r/%d?r=%d&ac=1", ctxt.CurrentCommunity().Alias, ctxt.GetScratch("currentAlias"), topic.Number, hdrs[0].Num), nil
}
/* TopicManage displays the "manage topic" page.
* Parameters:
* ctxt - The AmContext for the request.
* Returns:
* Command string dictating what to be rendered.
* Data as a parameter for the command string.
* Standard Go error status.
*/
func TopicManage(ctxt ui.AmContext) (string, any, error) {
comm := ctxt.CurrentCommunity()
topic := ctxt.GetScratch("currentTopic").(*database.Topic)
ctxt.VarMap().Set("backlink", fmt.Sprintf("/comm/%s/conf/%s/r/%d", comm.Alias, ctxt.GetScratch("currentAlias"), topic.Number))
opsLink := fmt.Sprintf("/comm/%s/conf/%s/op/%d", comm.Alias, ctxt.GetScratch("currentAlias"), topic.Number)
ctxt.VarMap().Set("opsLink", opsLink)
ctxt.VarMap().Set("topicName", topic.Name)
// Get the invitation flag.
member, _, _, err := comm.Membership(ctxt.Ctx(), ctxt.CurrentUser())
if err != nil {
return ui.ErrorPage(ctxt, err)
}
ctxt.VarMap().Set("canInvite", member)
ctxt.VarMap().Set("subscribed", false) // TODO
ctxt.VarMap().Set("bozos", make([]string, 0)) // TODO
ctxt.VarMap().Set("amsterdam_pageTitle", "Manage Topic: "+topic.Name)
return "framed_template", "manage_topic.jet", nil
}