Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,18 @@ func getStageTaskByName(stages []*models.StageTask, stageName string) *models.St
return nil
}

func buildWorkflowNotifyReleasePlan(releasePlan *models.ReleasePlanRef) *webhooknotify.WorkflowNotifyReleasePlan {
if releasePlan == nil {
return nil
}

return &webhooknotify.WorkflowNotifyReleasePlan{
ID: releasePlan.ID,
Name: releasePlan.Name,
Index: releasePlan.Index,
}
}

func (w *Service) getApproveNotificationContent(notify *models.NotifyCtl, task *models.WorkflowTask) (string, string, *LarkCard, *webhooknotify.WorkflowNotify, error) {
project, err := templaterepo.NewProductColl().Find(task.ProjectName)
if err != nil {
Expand Down Expand Up @@ -774,6 +786,7 @@ func (w *Service) getApproveNotificationContent(notify *models.NotifyCtl, task *
WorkflowDisplayName: task.WorkflowDisplayName,
ProjectName: task.ProjectName,
ProjectDisplayName: project.ProjectName,
ReleasePlan: buildWorkflowNotifyReleasePlan(task.ReleasePlan),
Status: task.Status,
Remark: task.Remark,
Error: task.Error,
Expand Down Expand Up @@ -973,6 +986,7 @@ func (w *Service) getNotificationContentWithOptions(notify *models.NotifyCtl, ta
WorkflowDisplayName: task.WorkflowDisplayName,
ProjectName: task.ProjectName,
ProjectDisplayName: project.ProjectName,
ReleasePlan: buildWorkflowNotifyReleasePlan(task.ReleasePlan),
Status: task.Status,
Remark: task.Remark,
Error: task.Error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type WorkflowNotify struct {
ProjectDisplayName string `json:"project_display_name"`
WorkflowName string `json:"workflow_name"`
WorkflowDisplayName string `json:"workflow_display_name"`
ReleasePlan *WorkflowNotifyReleasePlan `json:"release_plan,omitempty"`
Status config.Status `json:"status"`
Remark string `json:"remark"`
DetailURL string `json:"detail_url"`
Expand All @@ -77,6 +78,12 @@ type WorkflowNotify struct {
TaskType config.CustomWorkflowTaskType `json:"task_type"`
}

type WorkflowNotifyReleasePlan struct {
ID string `json:"id"`
Name string `json:"name"`
Index int64 `json:"index"`
}

type WorkflowNotifyStage struct {
Name string `json:"name"`
Status config.Status `json:"status"`
Expand Down
Loading