From 0c3527d3d84cd5672ca5bc98db1503faff3527b7 Mon Sep 17 00:00:00 2001 From: Amy Gale Ruth Bowersox Date: Mon, 23 Feb 2026 22:51:22 -0700 Subject: [PATCH] propagate the "pictures in posts" flag from global to community to conference at time of creation --- database/community.go | 19 +++++++++++++++++++ database/conference.go | 19 ++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/database/community.go b/database/community.go index 24a8620..df53770 100644 --- a/database/community.go +++ b/database/community.go @@ -931,6 +931,25 @@ func AmCreateCommunity(ctx context.Context, name string, alias string, hostUid i return nil, err } + // Set the "pictures in posts" flag default from the global flag. + g, err := AmGlobals(ctx) + if err != nil { + return nil, err + } + fglob, err := g.Flags(ctx) + if err != nil { + return nil, err + } + fcomm, err := comm.Flags(ctx) + if err != nil { + return nil, err + } + fcomm.Set(CommunityFlagPicturesInPosts, fglob.Get(GlobalFlagPicturesInPosts)) + err = comm.SaveFlags(ctx, fcomm) + if err != nil { + return nil, err + } + // operation was a success - add an audit record AmStoreAudit(AmNewCommAudit(AuditCommunityCreate, hostUid, comm.Id, remoteIP, fmt.Sprintf("id=%d", comm.Id), fmt.Sprintf("name=%s", comm.Name), fmt.Sprintf("alias=%s", comm.Alias))) diff --git a/database/conference.go b/database/conference.go index 171b9fa..0abd2b0 100644 --- a/database/conference.go +++ b/database/conference.go @@ -1304,8 +1304,25 @@ func AmCreateConference(ctx context.Context, comm *Community, name, alias, descr return nil, err } - // Add the new conference to the cache, and create our audit record. + // Add the new conference to the cache. conferenceCache.Add(rc.ConfId, &rc) + + // Set the "pictures in posts" flag for the conference from the community default. + fcomm, err := comm.Flags(ctx) + if err != nil { + return nil, err + } + fconf, err := rc.Flags(ctx) + if err != nil { + return nil, err + } + fconf.Set(ConferenceFlagPicturesInPosts, fcomm.Get(CommunityFlagPicturesInPosts)) + err = rc.SaveFlags(ctx, fconf) + if err != nil { + return nil, err + } + + // Create the audit record. AmStoreAudit(AmNewCommAudit(AuditConferenceCreate, u.Uid, comm.Id, ipaddr, fmt.Sprintf("confid=%d", rc.ConfId), fmt.Sprintf("name=%s", name), fmt.Sprintf("alias=%s", alias))) return &rc, nil }