Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: use plan's name and description when listing issues in store level (#17072)

boojack8de5410f961e
diff --git a/backend/api/v1/issue_service_convert.go b/backend/api/v1/issue_service_convert.go
index d726506692..000c451290 100644
--- a/backend/api/v1/issue_service_convert.go
+++ b/backend/api/v1/issue_service_convert.go
@@ -61,19 +61,7 @@ func (s *IssueService) convertToIssue(ctx context.Context, issue *store.IssueMes
}
if issue.PlanUID != nil {
- plan, err := s.store.GetPlan(ctx, &store.FindPlanMessage{UID: issue.PlanUID})
- if err != nil {
- return nil, errors.Wrapf(err, "failed to get plan by uid %v", issue.PlanUID)
- }
issueV1.Plan = common.FormatPlan(issue.Project.ResourceID, *issue.PlanUID)
- // Unification logic: Plan takes precedence over Issue when both exist.
- // Use plan's title and description when available (non-empty).
- if plan.Name != "" {
- issueV1.Title = plan.Name
- }
- if plan.Description != "" {
- issueV1.Description = plan.Description
- }
}
if issue.PipelineUID != nil {
issueV1.Rollout = common.FormatRollout(issue.Project.ResourceID, *issue.PipelineUID)
diff --git a/backend/component/webhook/manager.go b/backend/component/webhook/manager.go
index cdfcba88a4..11391ff7ef 100644
--- a/backend/component/webhook/manager.go
+++ b/backend/component/webhook/manager.go
@@ -81,6 +81,7 @@ func (m *Manager) getWebhookContextFromEvent(ctx context.Context, e *Event, even
titleZh := ""
link := ""
if e.Issue != nil {
+ // TODO(steven): Remove the slug dependency when the legacy issue page is removed.
link = fmt.Sprintf("%s/projects/%s/issues/%s-%d", setting.ExternalUrl, e.Project.ResourceID, slug.Make(e.Issue.Title), e.Issue.UID)
} else if e.Rollout != nil {
link = fmt.Sprintf("%s/projects/%s/rollouts/%d", setting.ExternalUrl, e.Project.ResourceID, e.Rollout.UID)
diff --git a/backend/store/issue.go b/backend/store/issue.go
index af059231e8..2a271dfb02 100644
--- a/backend/store/issue.go
+++ b/backend/store/issue.go
@@ -372,13 +372,14 @@ func (s *Store) ListIssueV2(ctx context.Context, find *FindIssueMessage) ([]*Iss
issue.project,
issue.pipeline_id,
issue.plan_id,
- issue.name,
+ COALESCE(plan.name, issue.name) AS name,
issue.status,
issue.type,
- issue.description,
+ COALESCE(plan.description, issue.description) AS description,
issue.payload,
COALESCE(task_run_status_count.status_count, '{}'::jsonb)
FROM %s
+ LEFT JOIN plan ON issue.plan_id = plan.id
LEFT JOIN LATERAL (
SELECT
jsonb_object_agg(t.status, t.count) AS status_count