Skip to content

Add project and column info to issue and pull request API responses#37036

Open
myers wants to merge 7 commits intogo-gitea:mainfrom
myers:feat/issue-project-meta
Open

Add project and column info to issue and pull request API responses#37036
myers wants to merge 7 commits intogo-gitea:mainfrom
myers:feat/issue-project-meta

Conversation

@myers
Copy link
Copy Markdown
Contributor

@myers myers commented Mar 29, 2026

Fixes #14299

API clients working with project boards currently need separate calls to discover which project and column an issue belongs to. This adds a project field to issue and pull request responses containing the project ID, title, state, and board column placement.

The project data is loaded via a LEFT JOIN on project_board when loading issue projects, keeping it to one query. List endpoints batch-load projects for all issues in the result set.

One concern: I followed what labels and milestones did and included most fields from the Project. I don't think we actually should send:

  • Description
  • State
  • Created
  • Updated
  • Closed

for every issue in a list the api gets. Maybe trim all three down in another PR?

Written with Claude Code and Opus, reviewed by a human.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 29, 2026
Comment thread services/convert/project.go Outdated
Comment thread services/convert/issue.go Outdated
@GiteaBot GiteaBot added lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 29, 2026
@wxiaoguang
Copy link
Copy Markdown
Contributor

Again, it conflicts with Multiple projects: #36784 , unless maintainers agree that we would never support multiple projects

@wxiaoguang wxiaoguang marked this pull request as draft March 30, 2026 01:05
@okdas okdas mentioned this pull request Apr 4, 2026
6 tasks
@myers
Copy link
Copy Markdown
Contributor Author

myers commented Apr 11, 2026

Again, it conflicts with Multiple projects: #36784 , unless maintainers agree that we would never support multiple projects

I don't understand blocking work that adds value because there is another change in the same area. That's why we have git and forges!

I'm happy they are adding that feature. I don't have any use for it myself. I would like to see us add missing features like this to the project and they can catch up and add support for these features in their PR, or if they get merged before I do, the other way around.

EDIT: after thinking about this for a while: I think you are asking for this api to return a list of projects per issue and this PR would only have 0 or 1 items in that list, and when the other PR lands the api doesn't change. Is that correct? I like that idea, I'm implementing it now, sorry it took me a while. :)

myers added 3 commits April 11, 2026 18:41
API clients working with project boards currently need separate calls
to discover which project and column an issue belongs to. This adds a
`project` field to issue and pull request responses containing the
project ID, title, state, and board column placement.

The project data is loaded via a LEFT JOIN on project_board when
loading issue projects, keeping it to one query. List endpoints
batch-load projects for all issues in the result set.
- Change ToAPIProject signature to take column fields directly
  instead of issue pointer (fixes nil panic risk)
- Add canDoerSeeProject permission check using EphemeralCache for
  batched org permission lookups in list endpoints
- Repo-level projects: visible if user can read the repo (already
  checked by API handler)
- Org-level projects: check org visibility + projects unit permission
- Add integration test for org project visibility in API responses

Co-Authored-By: Claude Opus 4 (claude-opus-4-6)
@myers myers force-pushed the feat/issue-project-meta branch from f6b6233 to 74fdb7e Compare April 11, 2026 19:31
myers added 3 commits April 11, 2026 19:58
Co-Authored-By: Claude Opus 4 (claude-opus-4-6)
Co-Authored-By: Claude Opus 4 (claude-opus-4-6)
Change the issue/PR API response from `project` (singular object)
to `projects` (array of objects). Today this array has 0 or 1
entries. When multi-project support lands (go-gitea#36784), the API contract
won't need to change.

Co-Authored-By: Claude Opus 4 (claude-opus-4-6)
@myers myers marked this pull request as ready for review April 11, 2026 21:23
@myers myers requested a review from bircni April 11, 2026 21:24
@myers
Copy link
Copy Markdown
Contributor Author

myers commented Apr 19, 2026

@wxiaoguang @bircni Would you mind reviewing this again?

@lunny
Copy link
Copy Markdown
Member

lunny commented Apr 19, 2026

@wxiaoguang @bircni Would you mind reviewing this again?

Let's merge #36784 first?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] API for projects

5 participants