File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -579,25 +579,14 @@ func (m *mprWorkflowMutator) replaceActivity(updated bson.D) {
579579}
580580
581581func replaceActivityRecursive (flow bson.D , actID string , updated bson.D ) bool {
582- activitiesVal := dGet (flow , "Activities" )
583- arr := toBsonA (activitiesVal )
584- if len (arr ) == 0 {
585- return false
586- }
587- // Skip the int32 type marker at index 0 if present.
588- start := 0
589- if _ , ok := arr [0 ].(int32 ); ok {
590- start = 1
591- } else if _ , ok := arr [0 ].(int ); ok {
592- start = 1
593- }
594- for i := start ; i < len (arr ); i ++ {
595- actDoc , ok := arr [i ].(bson.D )
582+ elements := dGetArrayElements (dGet (flow , "Activities" ))
583+ for i , elem := range elements {
584+ actDoc , ok := elem .(bson.D )
596585 if ! ok {
597586 continue
598587 }
599588 if extractBinaryIDFromDoc (dGet (actDoc , "$ID" )) == actID {
600- arr [i ] = updated
589+ elements [i ] = updated
601590 return true
602591 }
603592 for _ , nestedFlow := range getNestedFlows (actDoc ) {
You can’t perform that action at this time.
0 commit comments