Commit Graph

18 Commits (d501aec427fce0361da4531ae74321390344aa15)

Author SHA1 Message Date
Lauris BH bbd910ed1b
Allow to set protected file patterns that can not be changed under no conditions ()
Co-Authored-By: zeripath <art27@cantab.net>
Lunny Xiao dcaa5643d7
Fix branch api canPush and canMerge ()
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Lunny Xiao 83fe7d414e
Fix bug on branch API ()
zeripath 3fc4f3670c
Fix panic in API pulls when headbranch does not exist ()
* Fix panic in API pulls when headbranch does not exist
* refix other reference to plumbing.ErrReferenceNotFound

Signed-off-by: Andrew Thornton <art27@cantab.net>
Lunny Xiao 5abe1c52de
Display pull request head branch even the branch deleted or repository deleted ()
* Display pull request head branch even the branch deleted or repository deleted

* Merge getHeadRepo/loadHeadRepo and getBaseRepo/loadBaseRepo on pull and fill repo when pr.Issue.Repo is available

* retrieve sha from pull head when pull request branch deleted and fix tests

* Fix test

* Ensure MustHeadRepoName returns empty string if no head repo

Co-authored-by: zeripath <art27@cantab.net>
Gustavo Marin af61b2249a
adds API endpoints to manage OAuth2 Application (list/create/delete) ()
* add API endpoint to create OAuth2 Application.

* move endpoint to /user. Add swagger documentations and proper response type.

* change json tags to snake_case. add CreateOAuth2ApplicationOptions to swagger docs.

* change response status to Created (201)

* add methods to list OAuth2 apps and delete an existing OAuth2 app by ID.

* add APIFormat convert method and file header

* fixed header

* hide secret on oauth2 application list

* add Created time to API response

* add API integration tests for create/list/delete OAuth2 applications.

Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
6543 7e8cdba181
[Refactor] move APIFormat() of Issue and Label to convert package ()
* Label: delete .APIFormat() and use convert.ToLabel()

* move issue APIFormat too

* add missing one

* move TEST too

* handle error -> return empty APIIssue

* Apply suggestions from code review

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
David Svantesson 9ff4e1d2d9
Add API branch protection endpoint ()
* add API branch protection endpoint

* lint

* Change to use team names instead of ids.

* Status codes.

* fix

* Fix

* Add new branch protection options (BlockOnRejectedReviews, DismissStaleApprovals, RequireSignedCommits)

* Do xorm query directly

* fix xorm GetUserNamesByIDs

* Add some tests

* Improved GetTeamNamesByID

* http status created for CreateBranchProtection

* Correct status code in integration test

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
6543 8d43563a32
[BugFix] [API] Pull.API.Convert: Only try to get HeadBranch if HeadRepo exist ()
* only try to get HeadBranch if HeadRepo exist

* impruve

* no nil error

* add TEST

* correct error msg
Lunny Xiao 2677d071f9
Move newbranch to standalone package ()
* Move newbranch to standalone package

* move branch functions to modules to avoid dependencies cycles

* fix tests

* fix lint

* fix lint
David Svantesson 32fb813133 Allow repo admin to merge PR regardless of review status ()
* Allow repo admin to merge even if review is not ok.
Lunny Xiao 4d06d10dba Move tracked time api convert to convert package ()
Lunny Xiao 384c2b342e
Move pull request api convert to convert package ()
* Move pull request api convert to convert package

* Rename ToPullRequest to ToAPIPullRequest
6543 61c59bd695 [Bug] [API] Add language to user api ()
* add language to user api

* OK

Co-Authored-By: Lauris BH <lauris@nix.lv>
David Svantesson d0edb607a3 Fix what information is shown about user in API. ()
* Fix what information is shown about user in API.

* Use Email directly, as KeepEmailPrivate is already handled.
David Svantesson 69a255defb Team permission to create repository in organization ()
* Add team permission setting to allow creating repo in organization.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Add test case for creating repo when have team creation access.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* build error: should omit comparison to bool constant

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Add comment on exported functions

* Fix fixture consistency, fix existing unit tests

* Fix boolean comparison in xorm query.

* addCollaborator and changeCollaborationAccessMode separate steps

More clear to use different if-cases.

* Create and commit xorm session

* fix

* Add information of create repo permission in team sidebar

* Add migration step

* Clarify that repository creator will be administrator.

* Fix some things after merge

* Fix language text that use html

* migrations file

* Create repository permission -> Create repositories

* fix merge

* fix review comments
David Svantesson 86cff86b46 Update branch API endpoint to show effective branch protection. ()
* Add API endpoint for displaying effective branch protection.

* Add status checks.
Lunny Xiao daab245167
Move code.gitea.io/gitea/routers/api/v1/convert to code.gitea.io/gitea/modules/convert ()
* Move code.gitea.io/gitea/routers/api/v1/convert to code.gitea.io/gitea/modules/convert

* fix fmt