fix: address lint errors - import grouping, slices.Contains, append style
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user