aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/fork.go
Commit message (Collapse)AuthorAgeFilesLines
* Make git.OpenRepository accept Context (#19260)65432022-03-301-1/+1
| | | | | * OpenRepositoryCtx -> OpenRepository * OpenRepository -> openRepositoryWithDefaultContext, only for internal usage
* Move organization related structs into sub package (#18518)Lunny Xiao2022-03-291-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move organization related structs into sub package * Fix test * Fix lint * Move more functions into sub packages * Fix bug * Fix test * Update models/organization/team_repo.go Co-authored-by: KN4CK3R <admin@oldschoolhack.me> * Apply suggestions from code review Co-authored-by: KN4CK3R <admin@oldschoolhack.me> * Fix fmt * Follow suggestion from @Gusted * Fix test * Fix test * Fix bug * Use ctx but db.DefaultContext on routers * Fix bug * Fix bug * fix bug * Update models/organization/team_user.go * Fix bug Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Renamed ctx.User to ctx.Doer. (#19161)KN4CK3R2022-03-221-4/+4
| | | | Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* format with gofumpt (#18184)65432022-01-201-1/+1
| | | | | | | | | | | * gofumpt -w -l . * gofumpt -w -l -extra . * Add linter * manual fix * change make fmt
* - name: new parameter in CreateForkOption to give the forked repository (#18066)Aravinth Manivannan2021-12-241-2/+15
| | | | | | | | | | | a custom name, intended to be used when there's a name conflict - When a fork request results in a name conflict, HTTP 409: Conflict is returned instead of 500 - API documentation for the above mentioned changes Signed-off-by: realaravinth <realaravinth@batsense.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Some repository refactors (#17950)Lunny Xiao2021-12-121-2/+3
| | | | | | | | | * some repository refactors * remove unnecessary code * Fix test * Remove unnecessary banner
* Move repository model into models/repo (#17933)Lunny Xiao2021-12-101-1/+1
| | | | | | | | | | | | | | | * Some refactors related repository model * Move more methods out of repository * Move repository into models/repo * Fix test * Fix test * some improvements * Remove unnecessary function
* Move accessmode into models/perm (#17828)Lunny Xiao2021-11-281-1/+2
|
* Move user related model into models/user (#17781)Lunny Xiao2021-11-241-1/+2
| | | | | | | | | | | | | * Move user related model into models/user * Fix lint for windows * Fix windows lint * Fix windows lint * Move some tests in models * Merge
* Use a standalone struct name for Organization (#17632)Lunny Xiao2021-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | * Use a standalone struct name for Organization * recover unnecessary change * make the code readable * Fix template failure * Fix template failure * Move HasMemberWithUserID to org * Fix test * Remove unnecessary user type check * Fix test Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor the fork service slightly to take ForkRepoOptions (#16744)Kyle Evans2021-08-281-1/+5
| | | | | | | | | | | | | | | | | | | | * Refactor the fork service slightly to take ForkRepoOptions This reduces the number of places we need to change if we want to add other options during fork time. Signed-off-by: Kyle Evans <kevans@FreeBSD.org> * Fix integrations and tests after ForkRepository refactor Signed-off-by: Kyle Evans <kevans@FreeBSD.org> * Update OldRepo -> BaseRepo Signed-off-by: Kyle Evans <kevans@FreeBSD.org> * gofmt pass Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
* [API] generalize list header (#16551)65432021-08-121-0/+2
| | | | | | | | | | | | | * Add info about list endpoints to CONTRIBUTING.md * Let all list endpoints return X-Total-Count header * Add TODOs for GetCombinedCommitStatusByRef * Fix models/issue_stopwatch.go * Rrefactor models.ListDeployKeys * Introduce helper func and use them for SetLinkHeader related func
* Move macaron to chi (#14293)Lunny Xiao2021-01-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use [chi](https://github.com/go-chi/chi) instead of the forked [macaron](https://gitea.com/macaron/macaron). Since macaron and chi have conflicts with session share, this big PR becomes a have-to thing. According my previous idea, we can replace macaron step by step but I'm wrong. :( Below is a list of big changes on this PR. - [x] Define `context.ResponseWriter` interface with an implementation `context.Response`. - [x] Use chi instead of macaron, and also a customize `Route` to wrap chi so that the router usage is similar as before. - [x] Create different routers for `web`, `api`, `internal` and `install` so that the codes will be more clear and no magic . - [x] Use https://github.com/unrolled/render instead of macaron's internal render - [x] Use https://github.com/NYTimes/gziphandler instead of https://gitea.com/macaron/gzip - [x] Use https://gitea.com/go-chi/session which is a modified version of https://gitea.com/macaron/session and removed `nodb` support since it will not be maintained. **BREAK** - [x] Use https://gitea.com/go-chi/captcha which is a modified version of https://gitea.com/macaron/captcha - [x] Use https://gitea.com/go-chi/cache which is a modified version of https://gitea.com/macaron/cache - [x] Use https://gitea.com/go-chi/binding which is a modified version of https://gitea.com/macaron/binding - [x] Use https://github.com/go-chi/cors instead of https://gitea.com/macaron/cors - [x] Dropped https://gitea.com/macaron/i18n and make a new one in `code.gitea.io/gitea/modules/translation` - [x] Move validation form structs from `code.gitea.io/gitea/modules/auth` to `code.gitea.io/gitea/modules/forms` to avoid dependency cycle. - [x] Removed macaron log service because it's not need any more. **BREAK** - [x] All form structs have to be get by `web.GetForm(ctx)` in the route function but not as a function parameter on routes definition. - [x] Move Git HTTP protocol implementation to use routers directly. - [x] Fix the problem that chi routes don't support trailing slash but macaron did. - [x] `/api/v1/swagger` now will be redirect to `/api/swagger` but not render directly so that `APIContext` will not create a html render. Notices: - Chi router don't support request with trailing slash - Integration test `TestUserHeatmap` maybe mysql version related. It's failed on my macOS(mysql 5.7.29 installed via brew) but succeed on CI. Co-authored-by: 6543 <6543@obermui.de>
* Move Repo APIFormat to convert package (#13787)65432020-12-021-2/+3
| | | | | * Move Repo APIFormat to convert package * tweek
* Not using "ctx.ServerError" in api (#12907)赵智超2020-09-201-1/+1
| | | | | | This function will render a whole html page which is not useful for API. Signed-off-by: a1012112796 <1012112796@qq.com>
* Remove page size limit comment from swagger (#11806)Cirno the Strongest2020-06-091-1/+1
| | | Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* API add/generalize pagination (#9452)SpaWn2KiLl2020-01-241-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * paginate results * fixed deadlock * prevented breaking change * updated swagger * go fmt * fixed find topic * go mod tidy * go mod vendor with go1.13.5 * fixed repo find topics * fixed unit test * added Limit method to Engine struct; use engine variable when provided; fixed gitignore * use ItemsPerPage for default pagesize; fix GetWatchers, getOrgUsersByOrgID and GetStargazers; fix GetAllCommits headers; reverted some changed behaviors * set Page value on Home route * improved memory allocations * fixed response headers * removed logfiles * fixed import order * import order * improved swagger * added function to get models.ListOptions from context * removed pagesize diff on unit test * fixed imports * removed unnecessary struct field * fixed go fmt * scoped PR * code improvements * code improvements * go mod tidy * fixed import order * fixed commit statuses session * fixed files headers * fixed headers; added pagination for notifications * go mod tidy * go fmt * removed Private from user search options; added setting.UI.IssuePagingNum as default valeu on repo's issues list * Apply suggestions from code review Co-Authored-By: 6543 <6543@obermui.de> Co-Authored-By: zeripath <art27@cantab.net> * fixed build error * CI.restart() * fixed merge conflicts resolve * fixed conflicts resolve * improved FindTrackedTimesOptions.ToOptions() method * added backwards compatibility on ListReleases request; fixed issue tracked time ToSession * fixed build error; fixed swagger template * fixed swagger template * fixed ListReleases backwards compatibility * added page to user search route Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* Swagger info corrections (#9441)65432019-12-201-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * use numbers and not http.Status___ enum * fix test * add many missing swagger responses * code format * Deletion Sould return 204 ... * error handling improvements * if special error type ... then add it to swagger too * one smal nit * invalidTopicsError is []string * valid swagger specification 2.0 - if you add responses swagger can tell you if you do it right :+1: * use ctx.InternalServerError * Revert "use numbers and not http.Status___ enum" This reverts commit b1ff386e2418ed6a7f183e756b13277d701278ef. * use http.Status* enum everywhere
* Move some repositories' operations to a standalone service package (#8557)Lunny Xiao2019-10-261-1/+4
| | | | | | | | | | | | * Move some repositories' operations to a standalone service package * improve code * remove unused codes * add rollback when fork failed * add repo when return
* Use gitea forked macaron (#7933)Tamal Saha2019-08-231-1/+0
| | | Signed-off-by: Tamal Saha <tamal@appscode.com>
* Move sdk structs to modules/structs (#6905)Lunny Xiao2019-05-111-1/+1
| | | | | | | | | | | | * move sdk structs to moduels/structs * fix tests * fix fmt * fix swagger * fix vendor
* Restrict permission check on repositories and fix some problems (#5314)Lunny Xiao2018-11-281-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fix units permission problems * fix some bugs and merge LoadUnits to repoAssignment * refactor permission struct and add some copyright heads * remove unused codes * fix routes units check * improve permission check * add unit tests for permission * fix typo * fix tests * fix some routes * fix api permission check * improve permission check * fix some permission check * fix tests * fix tests * improve some permission check * fix some permission check * refactor AccessLevel * fix bug * fix tests * fix tests * fix tests * fix AccessLevel * rename CanAccess * fix tests * fix comment * fix bug * add missing unit for test repos * fix bug * rename some functions * fix routes check
* refactor: import order. (#3736)Bo-Yi Wu2018-03-291-2/+2
|
* Handle refactor (#3339)Morgan Bazalgette2018-01-101-1/+1
| | | | | | * Replace all ctx.Handle with ctx.ServerError or ctx.NotFound * Change Handle(403) to NotFound, avoid using macaron's NotFound
* Fix ignored errors when checking if organization, team member (#3177)Ethan Koenig2017-12-211-1/+5
|
* Update swagger documentation (#2899)Ethan Koenig2017-11-131-20/+42
| | | | | | | | | | | * Update swagger documentation Add docs for missing endpoints Add documentation for request parameters Make parameter naming consistent Fix response documentation * Restore delete comments
* Webhooks for repo creation/deletion (#1663)Ethan Koenig2017-09-031-1/+1
| | | | | | | | * Webhooks for repo creation/deletion * add createHookTask * Add handles for GetSlackPayload and GetDiscordPayload
* Improve swagger doc (#2274)Antoine GIRARD2017-08-211-2/+2
| | | | | | | | | | | | | | | | | | | | * Add swagger comment for adminCreateOrg * Add swagger comment for admin route * add hook swagger doc * Add tags * Add auth * Fix name of responses * Edit name method * Update vendor * make generate-swagger
* Fix repo API bug (#2133)Ethan Koenig2017-07-121-1/+2
| | | Don't require token when not necessary
* Improve org error handling (#2117)Antoine GIRARD2017-07-061-1/+1
| | | | | | | | | | * Improve ErrOrgNotExist type Return new error type Use good error check Use new method to check error Update tests * Fix unchanged method name report
* Add repo fork swagger (#1941)Jonas Östanbäck2017-06-121-0/+20
|
* Refactor and fix incorrect comment (#1247)Ethan Koenig2017-03-151-1/+1
|
* API endpoints for forks (#509)Ethan Koenig2016-12-311-0/+61