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:
parent
abeda11325
commit
542eb39d15
@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user