From 542eb39d15ddcbe907667d9078a79a56552baa43 Mon Sep 17 00:00:00 2001 From: beardev-in Date: Sun, 3 May 2026 17:26:03 +0530 Subject: [PATCH] fix: address lint errors - import grouping, slices.Contains, append style --- models/project/issue.go | 4 +--- routers/api/v1/repo/project.go | 12 ++++-------- services/projects/issue.go | 6 +++--- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/models/project/issue.go b/models/project/issue.go index eaf79d2cfd..5f152b4189 100644 --- a/models/project/issue.go +++ b/models/project/issue.go @@ -95,8 +95,6 @@ func DeleteAllProjectIssueByIssueIDsAndProjectIDs(ctx context.Context, issueIDs, _, err := db.GetEngine(ctx).In("project_id", projectIDs).In("issue_id", issueIDs).Delete(&ProjectIssue{}) return err } - - // MoveIssueToColumn moves a single issue to a specific column within a project. func MoveIssueToColumn(ctx context.Context, issueID, projectID, columnID int64) error { nextSorting, err := GetColumnIssueNextSorting(ctx, projectID, columnID) @@ -111,4 +109,4 @@ func MoveIssueToColumn(ctx context.Context, issueID, projectID, columnID int64) Sorting: nextSorting, }) return err -} \ No newline at end of file +} diff --git a/routers/api/v1/repo/project.go b/routers/api/v1/repo/project.go index 464270c968..74f19c8017 100644 --- a/routers/api/v1/repo/project.go +++ b/routers/api/v1/repo/project.go @@ -870,16 +870,12 @@ func assignIssueToProjectColumn(ctx *context.APIContext, add bool) { } } else { // Check if issue is already in this project - alreadyInProject := false - for _, id := range currentProjectIDs { - if id == column.ProjectID { - alreadyInProject = true - break - } - } + alreadyInProject := slices.Contains(currentProjectIDs, column.ProjectID) if !alreadyInProject { // Add to project first (lands in default column) - newProjectIDs := append(currentProjectIDs, column.ProjectID) + newProjectIDs := make([]int64, len(currentProjectIDs)+1) + copy(newProjectIDs, currentProjectIDs) + newProjectIDs[len(currentProjectIDs)] = column.ProjectID if err := issues_model.IssueAssignOrRemoveProject(ctx, issue, ctx.Doer, newProjectIDs); err != nil { ctx.APIErrorInternal(err) return diff --git a/services/projects/issue.go b/services/projects/issue.go index 01d067508f..3655a000ce 100644 --- a/services/projects/issue.go +++ b/services/projects/issue.go @@ -217,9 +217,9 @@ func LoadIssueNumbersForProject(ctx context.Context, project *project_model.Proj // for user or org projects, we need to check access permissions opts := issues_model.IssuesOptions{ ProjectIDs: []int64{project.ID}, - Doer: doer, - AllPublic: doer == nil, - Owner: project.Owner, + Doer: doer, + AllPublic: doer == nil, + Owner: project.Owner, } var err error