gitforge/services/convert
forgejo-backport-action a5a2cae7ee [v16.0/forgejo] chore(refactor): add getter/setter to APIContext data members (#13213)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/13143

The details of the refactor are in [a separate branch](https://codeberg.org/limiting-factor/forgejo/commits/branch/wip-api-context-accessors-save) which details how it was done. This pull request contains a squash of those commits rebased on top of the current Forgejo branch, which involved conflict resolution.

Given the magnitude of the change, there is a high chance that a large number of future pull requests merged in Forgejo will create conflicts. They will be dealt with in the same way  as chore: refactor orgAssignment to two separate middlewares (#13155).

## Review

The only risk I can think of is a getter/setter implementation being incorrectly implemented. This is probably where a detailed review is most needed, in the `services/context/api.go` file.

To not increase the size of the pull request, the `GetX()` accessors were preserved although they are redundant with `X()`. They will be removed in a followup pull request.

## Backporting strategy.

Cherry-picking the commit to v15 has a significant amount of conflicts in 8 files out of 111.

```
unmerged   routers/api/v1/activitypub/repository.go
unmerged   routers/api/v1/admin/user.go
unmerged   routers/api/v1/api.go
unmerged   routers/api/v1/org/team.go
unmerged   routers/api/v1/repo/action.go
unmerged   routers/api/v1/repo/pull.go
unmerged   routers/api/v1/user/follower.go
unmerged   services/context/api.go
```

Instead of resolving them, I think it is easier and safer to repeat the [refactor steps](https://codeberg.org/limiting-factor/forgejo/commits/branch/wip-api-context-accessors-save) in v15.

I also think it is worth the effort since it will avoid trivial backport conflicts on over 100 files.

## Context

This is a followup pull request discussed originally at  https://codeberg.org/forgejo/forgejo/pulls/12512

Co-authored-by: limiting-factor <limiting-factor@posteo.com>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13213
Reviewed-by: limiting-factor <limiting-factor@noreply.codeberg.org>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-06-27 18:27:57 +02:00
..
action.go feat: expose run_id in ...actions/runners/jobs endpoint (#12480) 2026-05-09 02:31:03 +02:00
activity.go
activitypub_person.go chore: update github.com/go-ap/activitypub to 902f6cf (#11301) 2026-04-02 23:57:13 +02:00
activitypub_user_action.go fix(activitypub): only return public activities on request (#12382) 2026-05-09 05:02:57 +02:00
attachment.go
attachment_test.go
convert.go feat(api): return created time in /org/{org} endpoint (#12633) 2026-05-28 21:25:41 +02:00
convert_test.go fix: get tag must return the tag signature instead of commit signature (#12351) 2026-05-03 04:41:12 +02:00
git_commit.go chore: ensure consistent import aliasing for services and models (#10253) 2025-11-30 17:00:57 +01:00
git_commit_test.go
issue.go
issue_comment.go perf: bulk load resolvers & reactions on pull request comments (#11988) 2026-04-05 14:37:09 +02:00
issue_test.go
main_test.go chore: move all test blank imports in a single package (#10662) 2026-01-02 05:32:32 +01:00
mirror.go
notification.go feat: rework notification table (#9926) 2025-11-29 23:03:56 +01:00
package.go
pull.go fix: return API URL in the url field for pull requests using the API (#12643) 2026-05-25 04:01:17 +02:00
pull_review.go feat(api,ui): add multiline comment on pullrequest (#12582) 2026-06-03 16:06:29 +02:00
pull_test.go
quota.go chore: ensure consistent import aliasing for services and models (#10253) 2025-11-30 17:00:57 +01:00
release.go
release_test.go
repository.go [v16.0/forgejo] chore(refactor): add getter/setter to APIContext data members (#13213) 2026-06-27 18:27:57 +02:00
status.go
user.go
user_test.go
utils.go
utils_test.go
wiki.go