File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -1137,12 +1137,33 @@ func HandleGetOrg(resp http.ResponseWriter, request *http.Request) {
11371137 org.SyncFeatures.EmailTrigger.Limit = 0
11381138
11391139 org.SyncFeatures.MultiTenant.Usage = int64(len(org.ChildOrgs) + 1)
1140-
11411140 if org.SyncUsage.MultiTenant.Counter != int64(len(org.ChildOrgs)+1) {
11421141 org.SyncUsage.MultiTenant.Counter = int64(len(org.ChildOrgs) + 1)
11431142 orgChanged = true
11441143 }
11451144
1145+ if len(org.CreatorOrg) == 0 {
1146+ allChildOrgs, err := GetAllChildOrgs(ctx, org.Id)
1147+ if err == nil {
1148+ if len(allChildOrgs) != len(org.ChildOrgs) {
1149+ allChildOrgsMini := []OrgMini{}
1150+ for _, child := range allChildOrgs {
1151+ allChildOrgsMini = append(allChildOrgsMini, OrgMini{
1152+ Id: child.Id,
1153+ Name: child.Name,
1154+ CreatorOrg: child.CreatorOrg,
1155+ Image: "",
1156+ RegionUrl: child.RegionUrl,
1157+ })
1158+ }
1159+ org.ChildOrgs = allChildOrgsMini
1160+ org.SyncFeatures.MultiTenant.Usage = int64(len(allChildOrgsMini) + 1)
1161+ org.SyncUsage.MultiTenant.Counter = int64(len(allChildOrgsMini) + 1)
1162+ orgChanged = true
1163+ }
1164+ }
1165+ }
1166+
11461167 if orgChanged {
11471168 log.Printf("[DEBUG] Org features for %s (%s) changed. Updating.", org.Name, org.Id)
11481169 err = SetOrg(ctx, *org, org.Id)
You can’t perform that action at this time.
0 commit comments