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,6 +167,7 @@ func (s *Service) getMigrationDataJSON(ctx context.Context, signedInUser *user.S
}) })
} }
if s.features.IsEnabledGlobally(featuremgmt.FlagOnPremToCloudMigrationsAlerts) && len(notificationPolicies.Name) > 0 {
// Notification Policy can only be managed by updating its entire tree, so we send the whole thing as one item. // Notification Policy can only be managed by updating its entire tree, so we send the whole thing as one item.
migrationDataSlice = append(migrationDataSlice, cloudmigration.MigrateDataRequestItem{ migrationDataSlice = append(migrationDataSlice, cloudmigration.MigrateDataRequestItem{
Type: cloudmigration.NotificationPolicyType, Type: cloudmigration.NotificationPolicyType,
@ -174,6 +175,7 @@ func (s *Service) getMigrationDataJSON(ctx context.Context, signedInUser *user.S
Name: notificationPolicies.Name, Name: notificationPolicies.Name,
Data: notificationPolicies.Routes, 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)