From f51f10402020eb1b0afa886955948a5737056f50 Mon Sep 17 00:00:00 2001 From: sushmith Date: Mon, 18 Sep 2023 16:39:39 +0530 Subject: [PATCH] fix: bug in appeal creation - bug: if a policy only has auto approval steps, and the appeal gets auto-approved, then with the current logic the appeal is approved but the grant never gets created. Fix this by adding a check --- core/appeal/service.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/appeal/service.go b/core/appeal/service.go index 9b30f976e..c5b22800b 100644 --- a/core/appeal/service.go +++ b/core/appeal/service.go @@ -276,7 +276,7 @@ func (s *Service) Create(ctx context.Context, appeals []*domain.Appeal, opts ... appeal.Policy = nil for _, approval := range appeal.Approvals { - if approval.Index == len(appeal.Approvals)-1 && approval.Status == domain.ApprovalStatusApproved { + if (approval.Index == len(appeal.Approvals)-1 && approval.Status == domain.ApprovalStatusApproved) || appeal.Status == domain.AppealStatusApproved { newGrant, revokedGrant, err := s.prepareGrant(ctx, appeal) if err != nil { return fmt.Errorf("preparing grant: %w", err)