gitea/routers/api/v1
wxiaoguang dd8bc1d61d
Refactor issue template parsing and fix API endpoint (#29069) (#29140)
Backport #29069

The old code `GetTemplatesFromDefaultBranch(...) ([]*api.IssueTemplate,
map[string]error)` doesn't really follow Golang's habits, then the
second returned value might be misused. For example, the API function
`GetIssueTemplates` incorrectly checked the second returned value and
always responds 500 error.

This PR refactors GetTemplatesFromDefaultBranch to
ParseTemplatesFromDefaultBranch and clarifies its behavior, and fixes
the API endpoint bug, and adds some tests.

And by the way, add proper prefix `X-` for the header generated in
`checkDeprecatedAuthMethods`, because non-standard HTTP headers should
have `X-` prefix, and it is also consistent with the new code in
`GetIssueTemplates`
2024-02-14 01:32:31 +00:00
..
activitypub More refactoring of `db.DefaultContext` (#27083) 2023-09-15 06:13:19 +00:00
admin Forbid removing the last admin user (#28337) (#28793) 2024-01-16 01:51:46 +00:00
misc More `db.DefaultContext` refactor (#27265) (#27347) 2023-09-29 13:35:01 +00:00
notify More `db.DefaultContext` refactor (#27265) (#27347) 2023-09-29 13:35:01 +00:00
org Delete repos of org when purge delete user (#27273) (#27728) 2023-11-01 10:03:12 +08:00
packages Another round of `db.DefaultContext` refactor (#27103) (#27262) 2023-09-25 19:24:35 +02:00
repo Refactor issue template parsing and fix API endpoint (#29069) (#29140) 2024-02-14 01:32:31 +00:00
settings Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
swagger refactor(API): refactor secret creation and update functionality (#26751) 2023-08-28 13:08:19 +08:00
user enable system users search via the API (#28013) (#28018) 2023-12-08 21:46:08 +00:00
utils Fix: system webhooks API bug (#28531) (#28666) 2023-12-31 12:53:09 +00:00
api.go Refactor issue template parsing and fix API endpoint (#29069) (#29140) 2024-02-14 01:32:31 +00:00