summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-03-01 23:05:44 +0100
committerGitHub <noreply@github.com>2020-03-02 00:05:44 +0200
commit4160bd6ef1e70f3e6ec6bb69b1cd37a66f14c4e3 (patch)
tree104077af60eb5e8d756da5d0c7a12f6e19ef3133 /routers
parentc08c975d368771237d6509df915d3ec315186612 (diff)
downloadgitea-4160bd6ef1e70f3e6ec6bb69b1cd37a66f14c4e3.tar.gz
gitea-4160bd6ef1e70f3e6ec6bb69b1cd37a66f14c4e3.zip
Remove Unused Functions (#10516)
* remove ReplaceLeft * remove GetRepositoryByOwnerAndName chainload to models.GetRepositoryByOwnerAndName * remove CheckUnitUser chainload to models.CheckUnitUser * remove MakeAssigneeList * remove DownloadDiff & DownloadPatch -> DownloadDiffOrPatch * remove GetRandomBytesAsBase64 * remove PushUpdateDeleteTags * remove GetUserByKeyID (you still can resolve user by "k, err := GetPublicKeyByID; userID := k.OwnerID") * remove BasicAuthEncode from struct package -> same function in modules/base/tools ! * remove UserID from api.utils * remove unused func from structs package
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/utils/utils.go8
-rw-r--r--routers/private/internal.go50
2 files changed, 0 insertions, 58 deletions
diff --git a/routers/api/v1/utils/utils.go b/routers/api/v1/utils/utils.go
index e02406d137..092ea3dbb6 100644
--- a/routers/api/v1/utils/utils.go
+++ b/routers/api/v1/utils/utils.go
@@ -13,14 +13,6 @@ import (
"code.gitea.io/gitea/modules/convert"
)
-// UserID user ID of authenticated user, or 0 if not authenticated
-func UserID(ctx *context.APIContext) int64 {
- if ctx.User == nil {
- return 0
- }
- return ctx.User.ID
-}
-
// GetQueryBeforeSince return parsed time (unix format) from URL query's before and since
func GetQueryBeforeSince(ctx *context.APIContext) (before, since int64, err error) {
qCreatedBefore := strings.Trim(ctx.Query("before"), " ")
diff --git a/routers/private/internal.go b/routers/private/internal.go
index b68a96c641..5bc01b0aea 100644
--- a/routers/private/internal.go
+++ b/routers/private/internal.go
@@ -8,7 +8,6 @@ package private
import (
"strings"
- "code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/private"
"code.gitea.io/gitea/modules/setting"
@@ -27,55 +26,6 @@ func CheckInternalToken(ctx *macaron.Context) {
}
}
-//GetRepositoryByOwnerAndName chainload to models.GetRepositoryByOwnerAndName
-func GetRepositoryByOwnerAndName(ctx *macaron.Context) {
- //TODO use repo.Get(ctx *context.APIContext) ?
- ownerName := ctx.Params(":owner")
- repoName := ctx.Params(":repo")
- repo, err := models.GetRepositoryByOwnerAndName(ownerName, repoName)
- if err != nil {
- ctx.JSON(500, map[string]interface{}{
- "err": err.Error(),
- })
- return
- }
- ctx.JSON(200, repo)
-}
-
-//CheckUnitUser chainload to models.CheckUnitUser
-func CheckUnitUser(ctx *macaron.Context) {
- repoID := ctx.ParamsInt64(":repoid")
- userID := ctx.ParamsInt64(":userid")
- repo, err := models.GetRepositoryByID(repoID)
- if err != nil {
- ctx.JSON(500, map[string]interface{}{
- "err": err.Error(),
- })
- return
- }
-
- var user *models.User
- if userID > 0 {
- user, err = models.GetUserByID(userID)
- if err != nil {
- ctx.JSON(500, map[string]interface{}{
- "err": err.Error(),
- })
- return
- }
- }
-
- perm, err := models.GetUserRepoPermission(repo, user)
- if err != nil {
- ctx.JSON(500, map[string]interface{}{
- "err": err.Error(),
- })
- return
- }
-
- ctx.JSON(200, perm.UnitAccessMode(models.UnitType(ctx.QueryInt("unitType"))))
-}
-
// RegisterRoutes registers all internal APIs routes to web application.
// These APIs will be invoked by internal commands for example `gitea serv` and etc.
func RegisterRoutes(m *macaron.Macaron) {