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)
| 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. |
| 1122 | func 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 | } |
no test coverage detected