MCPcopy Create free account
hub / github.com/bytebase/bytebase / NotifyIssueApproved

Function NotifyIssueApproved

backend/runner/approval/runner.go:1122–1142  ·  view source on GitHub ↗

NotifyIssueApproved sends the ISSUE_APPROVED webhook event when all approval steps complete. It notifies the issue creator that their issue has been fully approved.

(ctx context.Context, stores *store.Store, webhookManager *webhook.Manager, issue *store.IssueMessage, project *store.ProjectMessage, approver *store.UserMessage)

Source from the content-addressed store, hash-verified

1120// NotifyIssueApproved sends the ISSUE_APPROVED webhook event when all approval steps complete.
1121// It notifies the issue creator that their issue has been fully approved.
1122func NotifyIssueApproved(ctx context.Context, stores *store.Store, webhookManager *webhook.Manager, issue *store.IssueMessage, project *store.ProjectMessage, approver *store.UserMessage) {
1123 creatorAccount, err := stores.GetAccountByEmail(ctx, issue.CreatorEmail)
1124 if err != nil {
1125 slog.Warn("failed to get issue creator", log.BBError(err))
1126 return
1127 }
1128 if creatorAccount == nil {
1129 slog.Warn("issue creator account not found", slog.String("email", issue.CreatorEmail))
1130 return
1131 }
1132
1133 webhookManager.CreateEvent(ctx, &webhook.Event{
1134 Type: storepb.Activity_ISSUE_APPROVED,
1135 Project: webhook.NewProject(project),
1136 IssueApproved: &webhook.EventIssueApproved{
1137 Approver: &webhook.User{Name: approver.Name, Email: approver.Email, Phone: approver.Phone},
1138 Creator: &webhook.User{Name: creatorAccount.Name, Email: creatorAccount.Email, Phone: creatorAccount.Phone},
1139 Issue: webhook.NewIssue(issue),
1140 },
1141 })
1142}

Callers 1

ApproveIssueMethod · 0.92

Calls 6

BBErrorFunction · 0.92
NewProjectFunction · 0.92
NewIssueFunction · 0.92
GetAccountByEmailMethod · 0.80
CreateEventMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected