hook up the "delete conference" link on the "manage conference" page

This commit is contained in:
2026-02-20 22:43:36 -07:00
parent 8eab08fe31
commit 9ebda92311
4 changed files with 40 additions and 3 deletions
+36
View File
@@ -733,6 +733,42 @@ func ConferenceExport(ctxt ui.AmContext) (string, any) {
return "stream", r
}
/* DeleteConference handles the deletion of a conference from its operations menu.
* Parameters:
* ctxt - The AmContext for the request.
* Returns:
* Command string dictating what to be rendered.
* Data as a parameter for the command string.
*/
func DeleteConference(ctxt ui.AmContext) (string, any) {
comm := ctxt.CurrentCommunity()
conf := ctxt.GetScratch("currentConference").(*database.Conference)
myLevel := ctxt.GetScratch("levelInConference").(uint16)
if !conf.TestPermission("Conference.Delete", myLevel) {
return "error", ENOPERM
}
// Load the message box, and, if we have a valid "yes," then perform the delete
mbox, err := ui.AmLoadMessageBox("deleteConf")
if err != nil {
return "error", err
}
if mbox.Validate(ctxt, "yes") {
err := conf.Delete(ctxt.Ctx(), comm, ctxt.CurrentUser(), ctxt.RemoteIP(), ampool)
if err != nil {
return "error", err
}
return "redirect", fmt.Sprintf("/comm/%s/conf", ctxt.CurrentCommunity().Alias)
}
// Set up to display the message box.
mbox.SetMessage(fmt.Sprintf(`You are about to delete the conference <span class="font-bold text-red-600">"%s"</span>
from the <span class="font-bold text-red-600">"%s"</span> community!`, conf.Name, comm.Name))
mbox.SetLink("no", fmt.Sprintf("/comm/%s/conf/%s/manage", ctxt.CurrentCommunity().Alias, ctxt.GetScratch("currentAlias")))
mbox.SetLink("yes", fmt.Sprintf("/comm/%s/conf/%s/delete", ctxt.CurrentCommunity().Alias, ctxt.GetScratch("currentAlias")))
return mbox.Render(ctxt)
}
/* CreateConferenceForm displays the dialog for creating a new conference.
* Parameters:
* ctxt - The AmContext for the request.