summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/repo')
-rw-r--r--routers/api/v1/repo/pull.go6
-rw-r--r--routers/api/v1/repo/star.go3
2 files changed, 5 insertions, 4 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index 7f377edc3f..efe72e1502 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -953,10 +953,10 @@ func parseCompareInfo(ctx *context.APIContext, form api.CreatePullRequestOption)
}
// Check if current user has fork of repository or in the same repository.
- headRepo, has := models.HasForkedRepo(headUser.ID, baseRepo.ID)
- if !has && !isSameRepo {
+ headRepo := models.GetForkedRepo(headUser.ID, baseRepo.ID)
+ if headRepo == nil && !isSameRepo {
log.Trace("parseCompareInfo[%d]: does not have fork or in same repository", baseRepo.ID)
- ctx.NotFound("HasForkedRepo")
+ ctx.NotFound("GetForkedRepo")
return nil, nil, nil, nil, "", ""
}
diff --git a/routers/api/v1/repo/star.go b/routers/api/v1/repo/star.go
index 5fa42c3244..b8a54a6bda 100644
--- a/routers/api/v1/repo/star.go
+++ b/routers/api/v1/repo/star.go
@@ -7,6 +7,7 @@ package repo
import (
"net/http"
+ "code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
@@ -43,7 +44,7 @@ func ListStargazers(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/UserList"
- stargazers, err := ctx.Repo.Repository.GetStargazers(utils.GetListOptions(ctx))
+ stargazers, err := models.GetStargazers(ctx.Repo.Repository, utils.GetListOptions(ctx))
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetStargazers", err)
return