Skip to content

Commit

Permalink
update logic to simplify the code
Browse files Browse the repository at this point in the history
Signed-off-by: Anand Kumar Singh <[email protected]>
  • Loading branch information
anandrkskd committed Feb 10, 2025
1 parent 767626a commit e5e6c5d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions controllers/notificationsconfiguration/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ func mapToString(m map[string]string) string {
// return true if there is difference, and false if no changes observed
func checkIfContextChanged(cr *v1alpha1.NotificationsConfiguration, notificationConfigMap *corev1.ConfigMap) bool {
cmContext := strings.Split(strings.TrimSuffix(notificationConfigMap.Data["context"], "\n"), "\n")
if len(cmContext) == len(cr.Spec.Context) {
if len(cmContext) != len(cr.Spec.Context) {
return true
} else {
// Create a map for quick lookups
stringMap := make(map[string]bool)
for _, item := range cmContext {
Expand All @@ -111,8 +113,6 @@ func checkIfContextChanged(cr *v1alpha1.NotificationsConfiguration, notification
return true
}
}
} else {
return true
}
return false
}

0 comments on commit e5e6c5d

Please sign in to comment.