Skip to content

Allow multiple projects per issue and pull requests#36784

Open
icyavocado wants to merge 71 commits intogo-gitea:mainfrom
icyavocado:issue-12974-multiple-projects-per-issue
Open

Allow multiple projects per issue and pull requests#36784
icyavocado wants to merge 71 commits intogo-gitea:mainfrom
icyavocado:issue-12974-multiple-projects-per-issue

Conversation

@icyavocado
Copy link

@icyavocado icyavocado commented Feb 28, 2026

Add ability to add and remove multiple projects per issue and pull request.

E2E test video: video.webm

No breaking change expected.

Copilot was used to review changes, syntax and help with commit messages.

Resolve #12974

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 28, 2026
@github-actions github-actions bot added modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files labels Feb 28, 2026
icyavocado and others added 22 commits February 28, 2026 13:55
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Icy Avocado <avocado@ovacoda.com>
- instead of using shared projectDB for both query, split to two.
One to delete, and the other to update sorting
@icyavocado icyavocado force-pushed the issue-12974-multiple-projects-per-issue branch from b180da7 to a5dbb63 Compare February 28, 2026 20:55
Copy link
Author

@icyavocado icyavocado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressing previous concerns in #34386

return 0
func (issue *Issue) projectIDs(ctx context.Context) ([]int64, error) {
var pis []project_model.ProjectIssue
if err := db.GetEngine(ctx).Table("project_issue").Where("issue_id = ?", issue.ID).Cols("project_id").Find(&pis); err != nil {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#34386 (comment)

It's not safe to ignore the err, in case the SQL would be wrong.

Catched error and return nill.

// It adds projects that are in newProjectIDs but not currently assigned, and removes
// projects that are currently assigned but not in newProjectIDs. If newProjectIDs is
// empty or nil, all projects are removed from the issue.
func IssueAssignOrRemoveProject(ctx context.Context, issue *Issue, doer *user_model.User, newProjectIDs []int64, newColumnID int64) error {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#34386 (comment)

How could it be right?

Why newColumnID could apply to all newProjectIDs?

Target the default column of a project (if exists) defaultColumn, err := newProject.MustDefaultColumn(ctx)

NoLabel bool `json:"no_label"` // True if LabelIDs is empty
MilestoneID int64 `json:"milestone_id"`
ProjectID int64 `json:"project_id"`
ProjectIDs []int64 `json:"project_ids"`
Copy link
Author

@icyavocado icyavocado Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#34386 (comment)

I do not think the change is right for indexers, I am pretty sure it breaks existing indexers and the JSON field type doesn't match.

Force a reindex to projectIDs

@icyavocado icyavocado marked this pull request as draft February 28, 2026 21:12
@icyavocado icyavocado marked this pull request as ready for review February 28, 2026 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow multiple projects per issue

4 participants