diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2025-02-04 19:51:10 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-05 11:51:10 +0800 |
commit | 6999651b6d9804c5372b5abc67892b7eb74861db (patch) | |
tree | 2e15b6b678083c0e43844992783680ce69a37d58 /services/projects/issue.go | |
parent | a6819570be680a4ac9b064ae35913fde08af679e (diff) | |
download | gitea-6999651b6d9804c5372b5abc67892b7eb74861db.tar.gz gitea-6999651b6d9804c5372b5abc67892b7eb74861db.zip |
Fix unnecessary comment when moving issue on the same project column (#33496)
Fix #33482
Diffstat (limited to 'services/projects/issue.go')
-rw-r--r-- | services/projects/issue.go | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/services/projects/issue.go b/services/projects/issue.go index db1621a39f..6ca0f16806 100644 --- a/services/projects/issue.go +++ b/services/projects/issue.go @@ -55,22 +55,29 @@ func MoveIssuesOnProjectColumn(ctx context.Context, doer *user_model.User, colum continue } - _, err = db.Exec(ctx, "UPDATE `project_issue` SET project_board_id=?, sorting=? WHERE issue_id=?", column.ID, sorting, issueID) + projectColumnID, err := curIssue.ProjectColumnID(ctx) if err != nil { return err } - // add timeline to issue - if _, err := issues_model.CreateComment(ctx, &issues_model.CreateCommentOptions{ - Type: issues_model.CommentTypeProjectColumn, - Doer: doer, - Repo: curIssue.Repo, - Issue: curIssue, - ProjectID: column.ProjectID, - ProjectTitle: project.Title, - ProjectColumnID: column.ID, - ProjectColumnTitle: column.Title, - }); err != nil { + if projectColumnID != column.ID { + // add timeline to issue + if _, err := issues_model.CreateComment(ctx, &issues_model.CreateCommentOptions{ + Type: issues_model.CommentTypeProjectColumn, + Doer: doer, + Repo: curIssue.Repo, + Issue: curIssue, + ProjectID: column.ProjectID, + ProjectTitle: project.Title, + ProjectColumnID: column.ID, + ProjectColumnTitle: column.Title, + }); err != nil { + return err + } + } + + _, err = db.Exec(ctx, "UPDATE `project_issue` SET project_board_id=?, sorting=? WHERE issue_id=?", column.ID, sorting, issueID) + if err != nil { return err } } |