0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-22 06:23:30 +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{}) _, err := db.GetEngine(ctx).In("project_id", projectIDs).In("issue_id", issueIDs).Delete(&ProjectIssue{})
return err return err
} }
// MoveIssueToColumn moves a single issue to a specific column within a project. // MoveIssueToColumn moves a single issue to a specific column within a project.
func MoveIssueToColumn(ctx context.Context, issueID, projectID, columnID int64) error { func MoveIssueToColumn(ctx context.Context, issueID, projectID, columnID int64) error {
nextSorting, err := GetColumnIssueNextSorting(ctx, projectID, columnID) nextSorting, err := GetColumnIssueNextSorting(ctx, projectID, columnID)
@ -111,4 +109,4 @@ func MoveIssueToColumn(ctx context.Context, issueID, projectID, columnID int64)
Sorting: nextSorting, Sorting: nextSorting,
}) })
return err return err
} }

View File

@ -870,16 +870,12 @@ func assignIssueToProjectColumn(ctx *context.APIContext, add bool) {
} }
} else { } else {
// Check if issue is already in this project // Check if issue is already in this project
alreadyInProject := false alreadyInProject := slices.Contains(currentProjectIDs, column.ProjectID)
for _, id := range currentProjectIDs {
if id == column.ProjectID {
alreadyInProject = true
break
}
}
if !alreadyInProject { if !alreadyInProject {
// Add to project first (lands in default column) // 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 { if err := issues_model.IssueAssignOrRemoveProject(ctx, issue, ctx.Doer, newProjectIDs); err != nil {
ctx.APIErrorInternal(err) ctx.APIErrorInternal(err)
return 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 // for user or org projects, we need to check access permissions
opts := issues_model.IssuesOptions{ opts := issues_model.IssuesOptions{
ProjectIDs: []int64{project.ID}, ProjectIDs: []int64{project.ID},
Doer: doer, Doer: doer,
AllPublic: doer == nil, AllPublic: doer == nil,
Owner: project.Owner, Owner: project.Owner,
} }
var err error var err error