fix(projects): scope project-issue move to its own project #18

Merged
oleks merged 2 commits from fix/user-project-move-multiproject-detach into main 2026-05-17 17:06:19 +03:00
Owner

Summary

MoveIssuesOnProjectColumn updated the project_issue table with a WHERE issue_id = ? clause only. An issue assigned to multiple projects has one project_issue row per project, so moving it within one project rewrote project_board_id on every project's row — detaching the issue from all other projects it belonged to.

Fix scopes the UPDATE to (issue_id, project_id) so only the target project's row changes. This mirrors the fix already present in upstream/main.

Test plan

  • New integration regression test TestAPIUserProjects/MoveProjectIssueMultiProjectIsolation: issue in two user projects, move it within one, assert its column in the other project is unchanged. Passes with the fix.
  • Full TestAPIUserProjects suite green (sqlite).

Closes #17


Authored by Claude Opus 4.7 (assisting @oleks).

## Summary `MoveIssuesOnProjectColumn` updated the `project_issue` table with a `WHERE issue_id = ?` clause only. An issue assigned to multiple projects has one `project_issue` row per project, so moving it within one project rewrote `project_board_id` on every project's row — detaching the issue from all other projects it belonged to. Fix scopes the UPDATE to `(issue_id, project_id)` so only the target project's row changes. This mirrors the fix already present in `upstream/main`. ## Test plan - [x] New integration regression test `TestAPIUserProjects/MoveProjectIssueMultiProjectIsolation`: issue in two user projects, move it within one, assert its column in the other project is unchanged. Passes with the fix. - [x] Full `TestAPIUserProjects` suite green (sqlite). Closes #17 --- Authored by Claude Opus 4.7 (assisting @oleks).
oleks added 2 commits 2026-05-17 17:00:30 +03:00
Adds two improvements to the user/org/repo project-board REST API:

* state filter on column-issues endpoints (issue #4)
  GET /api/v1/{users,orgs}/{name}/-/projects/{id}/columns/{col}/issues
  GET /api/v1/repos/{owner}/{repo}/projects/{id}/columns/{col}/issues
  Now accept ?state=open|closed|all (default open), matching the convention
  on the project-list endpoint and on /repos/.../issues. Applied at the
  IssuesOptions layer so all three scopes inherit the filter.

* populated num_issues / num_open_issues / num_closed_issues on column-list
  (issue #5)
  ColumnList.LoadIssueCounts runs two grouped queries against project_issue
  joined with issue (one open, one closed). All three List*Columns handlers
  call it before converting, so num_issues stops being null and consumers
  can render a kanban summary in a single round trip instead of N+1.

Tests:
* unit: empty-input fast path on ColumnList.LoadIssueCounts.
* integration: extended testAPIListProjectColumnIssues / -User / -Org to
  close an issue, then verify default=open hides it, state=closed and
  state=all return it, and the column-list response carries the correct
  open/closed/total split.

Closes #4, closes #5
MoveIssuesOnProjectColumn updated `project_issue` with a WHERE clause on
issue_id only. An issue assigned to several projects has one project_issue
row per project, so moving it within one project rewrote project_board_id
for every project the issue belonged to, detaching it from all the others.

Scope the UPDATE to (issue_id, project_id) so only the target project's
row changes. Mirrors the fix already present in upstream/main.

Adds an integration regression test asserting an issue in two user
projects keeps its column in the other project after a move. Fixes #17.
oleks merged commit ad46f6cde8 into main 2026-05-17 17:06:19 +03:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: oleks/gitea#18