propagate the "pictures in posts" flag from global to community to conference at time of creation
This commit is contained in:
@@ -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)))
|
||||
|
||||
+18
-1
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user