Skip to content

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

fix: new created issue's title and description (#17073)

boojack8cbc84c880ad
diff --git a/backend/store/issue.go b/backend/store/issue.go
index 2a271dfb02..7eee2fcc14 100644
--- a/backend/store/issue.go
+++ b/backend/store/issue.go
@@ -132,16 +132,10 @@ func (s *Store) GetIssueV2(ctx context.Context, find *FindIssueMessage) (*IssueM
// CreateIssueV2 creates a new issue.
func (s *Store) CreateIssueV2(ctx context.Context, create *IssueMessage, creatorID int) (*IssueMessage, error) {
create.Status = storepb.Issue_OPEN
-
payload, err := protojson.Marshal(create.Payload)
if err != nil {
return nil, errors.Wrapf(err, "failed to marshal issue payload")
}
- creator, err := s.GetUserByID(ctx, creatorID)
- if err != nil {
- return nil, err
- }
-
tsVector := getTSVector(fmt.Sprintf("%s %s", create.Title, create.Description))
query := `
INSERT INTO issue (
@@ -157,8 +151,7 @@ func (s *Store) CreateIssueV2(ctx context.Context, create *IssueMessage, creator
ts_vector
)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
- RETURNING id, created_at, updated_at
- `
+ RETURNING id`
tx, err := s.db.BeginTx(ctx, nil)
if err != nil {
@@ -179,25 +172,17 @@ func (s *Store) CreateIssueV2(ctx context.Context, create *IssueMessage, creator
tsVector,
).Scan(
&create.UID,
- &create.CreatedAt,
- &create.UpdatedAt,
); err != nil {
if err == sql.ErrNoRows {
return nil, common.FormatDBErrorEmptyRowWithQuery(query)
}
return nil, err
}
- create.Creator = creator
-
if err := tx.Commit(); err != nil {
return nil, err
}
- s.issueCache.Add(create.UID, create)
- if create.PipelineUID != nil {
- s.issueByPipelineCache.Add(*create.PipelineUID, create)
- }
- return create, nil
+ return s.GetIssueV2(ctx, &FindIssueMessage{UID: &create.UID})
}
// UpdateIssueV2 updates an issue.
@@ -579,10 +564,14 @@ func (s *Store) BackfillIssueTSVector(ctx context.Context) error {
chunkSize := 50
offset := 0
selectQuery := `
- SELECT id, name, description
+ SELECT
+ issue.id,
+ COALESCE(plan.name, issue.name) AS name,
+ COALESCE(plan.description, issue.description) AS description
FROM issue
- WHERE ts_vector IS NULL
- ORDER BY id
+ LEFT JOIN plan ON issue.plan_id = plan.id
+ WHERE issue.ts_vector IS NULL
+ ORDER BY issue.id
LIMIT $1
OFFSET $2
`
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue
index e227aa7357..2f3ed9defb 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue
@@ -284,6 +284,19 @@ const doCreateIssue = async () => {
loading.value = true;
try {
+ // Update the plan description if it has changed before creating the issue.
+ if (description.value !== plan.value.description) {
+ await planServiceClientConnect.updatePlan(
+ create(UpdatePlanRequestSchema, {
+ plan: {
+ name: plan.value.name,
+ description: description.value,
+ },
+ updateMask: { paths: ["description"] },
+ })
+ );
+ }
+
const request = create(CreateIssueRequestSchema, {
parent: project.value.name,
issue: create(IssueSchema, {
@@ -297,20 +310,7 @@ const doCreateIssue = async () => {
});
const createdIssue = await issueServiceClientConnect.createIssue(request);
- // Update the plan description if it has changed.
- if (description.value !== plan.value.description) {
- await planServiceClientConnect.updatePlan(
- create(UpdatePlanRequestSchema, {
- plan: {
- name: plan.value.name,
- description: description.value,
- },
- updateMask: { paths: ["description"] },
- })
- );
- }
-
- // Then create the rollout from the plan
+ // Then create the rollout from the plan.
const rolloutRequest = create(CreateRolloutRequestSchema, {
parent: project.value.name,
rollout: {