0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-15 15:03:32 +02:00

fix: address lint errors - import grouping, slices.Contains, append style

This commit is contained in:
beardev-in 2026-05-03 17:26:03 +05:30
parent abeda11325
commit 542eb39d15
No known key found for this signature in database
GPG Key ID: 625E0CB70AFF32B9
3 changed files with 8 additions and 14 deletions

View File

@ -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
}
}

View File

@ -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

View File

@ -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