merge upstream & fix conflicts

This commit is contained in:
Manush Dodunekov
2020-01-10 19:06:42 +01:00
62 changed files with 4142 additions and 1933 deletions
+7 -4
View File
@@ -13,6 +13,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification"
@@ -102,7 +103,7 @@ func ListPullRequests(ctx *context.APIContext, form api.ListPullRequestsOptions)
ctx.Error(http.StatusInternalServerError, "GetHeadRepo", err)
return
}
apiPrs[i] = prs[i].APIFormat()
apiPrs[i] = convert.ToAPIPullRequest(prs[i])
}
ctx.SetLinkHeader(int(maxResults), models.ItemsPerPage)
@@ -136,6 +137,8 @@ func GetPullRequest(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/PullRequest"
// "404":
// "$ref": "#/responses/notFound"
pr, err := models.GetPullRequestByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
@@ -155,7 +158,7 @@ func GetPullRequest(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "GetHeadRepo", err)
return
}
ctx.JSON(http.StatusOK, pr.APIFormat())
ctx.JSON(http.StatusOK, convert.ToAPIPullRequest(pr))
}
// CreatePullRequest does what it says
@@ -319,7 +322,7 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption
notification.NotifyNewPullRequest(pr)
log.Trace("Pull request created: %d/%d", repo.ID, prIssue.ID)
ctx.JSON(http.StatusCreated, pr.APIFormat())
ctx.JSON(http.StatusCreated, convert.ToAPIPullRequest(pr))
}
// EditPullRequest does what it says
@@ -477,7 +480,7 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
}
// TODO this should be 200, not 201
ctx.JSON(http.StatusCreated, pr.APIFormat())
ctx.JSON(http.StatusCreated, convert.ToAPIPullRequest(pr))
}
// IsPullRequestMerged checks if a PR exists given an index
+42 -9
View File
@@ -282,11 +282,12 @@ func Create(ctx *context.APIContext, opt api.CreateRepoOption) {
CreateUserRepo(ctx, ctx.User, opt)
}
// CreateOrgRepo create one repository of the organization
func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
// swagger:operation POST /org/{org}/repos organization createOrgRepo
// CreateOrgRepoDeprecated create one repository of the organization
func CreateOrgRepoDeprecated(ctx *context.APIContext, opt api.CreateRepoOption) {
// swagger:operation POST /org/{org}/repos organization createOrgRepoDeprecated
// ---
// summary: Create a repository in an organization
// deprecated: true
// consumes:
// - application/json
// produces:
@@ -309,6 +310,37 @@ func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
// "403":
// "$ref": "#/responses/forbidden"
CreateOrgRepo(ctx, opt)
}
// CreateOrgRepo create one repository of the organization
func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
// swagger:operation POST /orgs/{org}/repos organization createOrgRepo
// ---
// summary: Create a repository in an organization
// deprecated: true
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: org
// in: path
// description: name of organization
// type: string
// required: true
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/CreateRepoOption"
// responses:
// "201":
// "$ref": "#/responses/Repository"
// "404":
// "$ref": "#/responses/notFound"
// "403":
// "$ref": "#/responses/forbidden"
org, err := models.GetOrgByName(ctx.Params(":org"))
if err != nil {
if models.IsErrOrgNotExist(err) {
@@ -452,12 +484,13 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
}
repo, err := models.CreateRepository(ctx.User, ctxUser, models.CreateRepoOptions{
Name: opts.RepoName,
Description: opts.Description,
OriginalURL: form.CloneAddr,
IsPrivate: opts.Private,
IsMirror: opts.Mirror,
Status: models.RepositoryBeingMigrated,
Name: opts.RepoName,
Description: opts.Description,
OriginalURL: form.CloneAddr,
GitServiceType: gitServiceType,
IsPrivate: opts.Private,
IsMirror: opts.Mirror,
Status: models.RepositoryBeingMigrated,
})
if err != nil {
handleMigrateError(ctx, ctxUser, remoteAddr, err)