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.
+2 -2
View File
@@ -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
+1
View File
@@ -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)
+1 -1
View File
@@ -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