CloudMigrations: only append notification policy if feature flag is on and it exists (#94896)

This commit is contained in:
Matheus Macabu 2024-10-17 17:15:30 +02:00 committed by GitHub
parent ccedc41c57
commit 8673c757a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -167,13 +167,15 @@ func (s *Service) getMigrationDataJSON(ctx context.Context, signedInUser *user.S
}) })
} }
// Notification Policy can only be managed by updating its entire tree, so we send the whole thing as one item. if s.features.IsEnabledGlobally(featuremgmt.FlagOnPremToCloudMigrationsAlerts) && len(notificationPolicies.Name) > 0 {
migrationDataSlice = append(migrationDataSlice, cloudmigration.MigrateDataRequestItem{ // Notification Policy can only be managed by updating its entire tree, so we send the whole thing as one item.
Type: cloudmigration.NotificationPolicyType, migrationDataSlice = append(migrationDataSlice, cloudmigration.MigrateDataRequestItem{
RefID: notificationPolicies.Name, // no UID available Type: cloudmigration.NotificationPolicyType,
Name: notificationPolicies.Name, RefID: notificationPolicies.Name, // no UID available
Data: notificationPolicies.Routes, Name: notificationPolicies.Name,
}) Data: notificationPolicies.Routes,
})
}
// Obtain the names of parent elements for Dashboard and Folders data types // Obtain the names of parent elements for Dashboard and Folders data types
parentNamesByType, err := s.getParentNames(ctx, signedInUser, dashs, folders, libraryElements) parentNamesByType, err := s.getParentNames(ctx, signedInUser, dashs, folders, libraryElements)