MCPcopy Index your code
hub / github.com/bytebase/bytebase / FindNextPendingRole

Function FindNextPendingRole

backend/utils/utils.go:34–46  ·  view source on GitHub ↗

FindNextPendingRole finds the next pending role in the approval flow.

(approval *storepb.IssuePayloadApproval)

Source from the content-addressed store, hash-verified

32
33// FindNextPendingRole finds the next pending role in the approval flow.
34func FindNextPendingRole(approval *storepb.IssuePayloadApproval) string {
35 if approval == nil || approval.ApprovalTemplate == nil {
36 return ""
37 }
38 // We can do the finding like this for now because we are presuming that
39 // one role is approved by one approver.
40 // and the approver status is either
41 // APPROVED or REJECTED.
42 if len(approval.Approvers) >= len(approval.ApprovalTemplate.Flow.Roles) {
43 return ""
44 }
45 return approval.ApprovalTemplate.Flow.Roles[len(approval.Approvers)]
46}
47
48// FindRejectedRole finds the rejected role in the approval flow.
49func FindRejectedRole(approval *storepb.IssuePayloadApproval) string {

Callers 4

NotifyApprovalRequestedFunction · 0.92
ApproveIssueMethod · 0.92
RejectIssueMethod · 0.92
CheckApprovalApprovedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected