From e77ecf2a0655d7b1753cf5f06758fdccc8bdd4cd Mon Sep 17 00:00:00 2001 From: Amy Gale Ruth Bowersox Date: Sun, 19 Oct 2025 15:06:41 -0600 Subject: [PATCH] debugged community creation process --- communityadmin.go | 4 ++-- database/community.go | 11 ----------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/communityadmin.go b/communityadmin.go index 6107dd9..bd550f8 100644 --- a/communityadmin.go +++ b/communityadmin.go @@ -383,7 +383,7 @@ func CreateCommunityForm(ctxt ui.AmContext) (string, any, error) { return ui.ErrorPage(ctxt, errors.New("you are not permitted to create a community")) } dlg, err := ui.AmLoadDialog("create_comm") - if err != nil { + if err == nil { dlg.Field("language").Value = "en-US" dlg.Field("country").Value = "US" return dlg.Render(ctxt) @@ -406,7 +406,7 @@ func CreateCommunity(ctxt ui.AmContext) (string, any, error) { return ui.ErrorPage(ctxt, errors.New("you are not permitted to create a community")) } dlg, err := ui.AmLoadDialog("create_comm") - if err != nil { + if err == nil { dlg.LoadFromForm(ctxt) action := dlg.WhichButton(ctxt) if action == "cancel" { diff --git a/database/community.go b/database/community.go index cd944bc..950a49f 100644 --- a/database/community.go +++ b/database/community.go @@ -571,14 +571,6 @@ func AmCreateCommunity(name string, alias string, hostUid int32, language *strin AmStoreAudit(ar) }() - unlock := true - amdb.Exec("LOCK TABLES communities WRITE, commftrs WRITE, commmember WRITE;") - defer func() { - if unlock { - amdb.Exec("UNLOCK TABLES;") - } - }() - // validate alias does not already exist rs, err := amdb.Query("SELECT commid FROM communities WHERE alias = ?", alias) if err != nil { @@ -623,9 +615,6 @@ func AmCreateCommunity(name string, alias string, hostUid int32, language *strin } stuffMembership(comm.Id, hostUid, true, true, AmDefaultRole("Community.Creator").Level()) - amdb.Exec("UNLOCK TABLES;") - unlock = false - // operation was a success - add an audit record ar = AmNewAudit(AuditCommunityCreate, hostUid, remoteIP, fmt.Sprintf("id=%d", comm.Id), fmt.Sprintf("name=%s", comm.Name), fmt.Sprintf("alias=%s", comm.Alias))