From 9ebda9231119434167636788b54ee15910f95d5c Mon Sep 17 00:00:00 2001 From: Amy Gale Ruth Bowersox Date: Fri, 20 Feb 2026 22:43:36 -0700 Subject: [PATCH] hook up the "delete conference" link on the "manage conference" page --- conferenceadmin.go | 36 ++++++++++++++++++++++++++++++++++++ docs/MISSINGFUNCS.md | 4 ++-- main.go | 1 + ui/menudefs.yaml | 2 +- 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/conferenceadmin.go b/conferenceadmin.go index 0efcf93..ed8e5cb 100644 --- a/conferenceadmin.go +++ b/conferenceadmin.go @@ -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 "%s" + from the "%s" 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. diff --git a/docs/MISSINGFUNCS.md b/docs/MISSINGFUNCS.md index 399b992..8a65484 100644 --- a/docs/MISSINGFUNCS.md +++ b/docs/MISSINGFUNCS.md @@ -18,7 +18,7 @@ _(italicized items can be deferred)_ - ~~User Account Management~~ - System Audit Logs - Import User Accounts -- Conferences list: +- ~~Conferences list:~~ - ~~Find~~ - ~~Manage (reorder/show/hide/delete)~~ - ~~Create New~~ @@ -70,7 +70,7 @@ _(italicized items can be deferred)_ - ~~E-mail~~ - ~~Export Messages~~ - Import Messages - - Delete Conference + - ~~Delete Conference~~ - ~~Add to Hotlist/Remove from Hotlist~~ - Related to bugs in Export Messages caused by bad data: - Provide a per-conference flag that will set BuggyAttachment behavior diff --git a/main.go b/main.go index 732c0d6..c1e23fa 100644 --- a/main.go +++ b/main.go @@ -143,6 +143,7 @@ func setupEcho() *echo.Echo { confGroup.POST("/email", ui.AmWrap(ConferenceEmail)) confGroup.GET("/export", ui.AmWrap(ConferenceExportForm)) confGroup.POST("/export", ui.AmWrap(ConferenceExport)) + confGroup.GET("/delete", ui.AmWrap(DeleteConference)) confGroup.GET("/hotlist", ui.AmWrap(AddToHotlist)) confGroup.GET("/invite", ui.AmWrap(InviteToConference)) confGroup.GET("/r/:topic", ui.AmWrap(ReadPosts), ui.SetTopic) diff --git a/ui/menudefs.yaml b/ui/menudefs.yaml index 6d529ce..16f52e3 100644 --- a/ui/menudefs.yaml +++ b/ui/menudefs.yaml @@ -108,5 +108,5 @@ menudefs: - text: "Import Messages" link: "/TODO/comm/[CID]/conf/[CONFID]/import" - text: "Delete Conference" - link: "/TODO/comm/[CID]/conf/[CONFID]/delete" + link: "/comm/[CID]/conf/[CONFID]/delete" hazard: true