Skip to content

Commit 8184372

Browse files
Fix rebasing issues
- Due to new architectural changes in gitea some files had to be relocated. - Some modules got renamed, use the new names. PS: this was painful we should sync with upstream more often.
1 parent 275b205 commit 8184372

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

routers/api/v1/repo/migrate.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"code.gitea.io/gitea/models"
1313
"code.gitea.io/gitea/modules/context"
1414
"code.gitea.io/gitea/modules/convert"
15-
auth "code.gitea.io/gitea/modules/forms"
1615
"code.gitea.io/gitea/modules/lfs"
1716
"code.gitea.io/gitea/modules/log"
1817
"code.gitea.io/gitea/modules/migrations"
@@ -68,7 +67,7 @@ func Migrate(ctx *context.APIContext) {
6867
ctx.Error(http.StatusInternalServerError, "", ctx.Tr("repo.migrate.invalid_lfs_endpoint"))
6968
return
7069
}
71-
err = migrations.IsMigrateURLAllowed(ep.String(), ctx.User)
70+
err := migrations.IsMigrateURLAllowed(ep.String(), ctx.User)
7271
if err != nil {
7372
handleRemoteAddrError(ctx, err)
7473
return
@@ -198,7 +197,7 @@ func handleMigrateError(ctx *context.APIContext, repoOwner *models.User, migrati
198197
case base.IsErrNotSupported(err):
199198
ctx.Error(http.StatusUnprocessableEntity, "", err)
200199
default:
201-
remoteAddr, _ := auth.ParseRemoteAddr(migrationOpts.CloneAddr, migrationOpts.AuthUsername, migrationOpts.AuthPassword)
200+
remoteAddr, _ := forms.ParseRemoteAddr(migrationOpts.CloneAddr, migrationOpts.AuthUsername, migrationOpts.AuthPassword)
202201
err = util.NewStringURLSanitizedError(err, remoteAddr, true)
203202
if strings.Contains(err.Error(), "Authentication failed") ||
204203
strings.Contains(err.Error(), "Bad credentials") ||
@@ -253,7 +252,7 @@ func GetMigratingTask(ctx *context.APIContext) {
253252
// "$ref": "#/responses/"
254253
// "404":
255254
// "$ref": "#/response/"
256-
t, err := models.GetMigratingTask(ctx.QueryInt64("repo_id"))
255+
t, err := models.GetMigratingTask(ctx.FormInt64("repo_id"))
257256

258257
if err != nil {
259258
ctx.JSON(http.StatusNotFound, err)
@@ -262,7 +261,7 @@ func GetMigratingTask(ctx *context.APIContext) {
262261

263262
ctx.JSON(200, map[string]interface{}{
264263
"status": t.Status,
265-
"err": t.Errors,
264+
"err": t.Message,
266265
"repo-id": t.RepoID,
267266
"start": t.StartTime,
268267
"end": t.EndTime,

routers/kitspace.go renamed to routers/web/kitspace.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package routers
1+
package web
22

33
import (
44
"bytes"
@@ -31,7 +31,7 @@ func Kitspace(ctx *context.Context) {
3131
)
3232
var user *structs.User
3333
if ctx.User != nil && ctx.IsSigned {
34-
user = convert.ToUser(ctx.User, true, true)
34+
user = convert.ToUser(ctx.User, ctx.User)
3535
}
3636

3737
m := KitspaceSession{
@@ -44,7 +44,7 @@ func Kitspace(ctx *context.Context) {
4444
panic(err)
4545
}
4646

47-
req, err := http.NewRequest("GET", url.String(), bytes.NewBuffer(b))
47+
req, _ := http.NewRequest("GET", url.String(), bytes.NewBuffer(b))
4848
req.Header.Add("Content-Type", "application/json")
4949

5050
resp, err := http.DefaultClient.Do(req)

routers/web/repo/editor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ func UploadFilePost(ctx *context.Context) {
733733
func UploadFilePostJson(ctx *context.Context) {
734734
// `renderCommitRights` is a poorly named; it's not responsible directly for rendering anything,
735735
// it returns a boolean
736-
form := web.GetForm(ctx).(*auth.UploadRepoFileForm)
736+
form := web.GetForm(ctx).(*forms.UploadRepoFileForm)
737737
canCommit := renderCommitRights(ctx)
738738
oldBranchName := ctx.Repo.BranchName
739739
branchName := oldBranchName

routers/user/kitspace_auth.go renamed to routers/web/user/kitspace_auth.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import (
55

66
"code.gitea.io/gitea/models"
77
"code.gitea.io/gitea/modules/context"
8-
auth "code.gitea.io/gitea/modules/forms"
98
"code.gitea.io/gitea/modules/log"
109
"code.gitea.io/gitea/modules/password"
1110
"code.gitea.io/gitea/modules/setting"
1211
"code.gitea.io/gitea/modules/timeutil"
1312
"code.gitea.io/gitea/modules/web"
13+
"code.gitea.io/gitea/services/auth"
14+
"code.gitea.io/gitea/services/forms"
1415
"code.gitea.io/gitea/services/mailer"
1516
)
1617

@@ -38,7 +39,7 @@ func KitspaceSignUp(ctx *context.Context) {
3839
// "422":
3940
// "$ref": "#/responses/validationError"
4041
response := make(map[string]string)
41-
form := web.GetForm(ctx).(*auth.RegisterForm)
42+
form := web.GetForm(ctx).(*forms.RegisterForm)
4243

4344
if len(form.Password) < setting.MinPasswordLength {
4445
response["error"] = "UnprocessableEntity"
@@ -111,7 +112,6 @@ func KitspaceSignUp(ctx *context.Context) {
111112
)
112113

113114
ctx.JSON(http.StatusCreated, response)
114-
return
115115
}
116116

117117
// KitspaceSignIn custom sign-in compatible with Kitspace architecture
@@ -140,8 +140,8 @@ func KitspaceSignIn(ctx *context.Context) {
140140
// "422":
141141
// "$ref": "#/responses/validationError"
142142

143-
form := web.GetForm(ctx).(*auth.SignInForm)
144-
u, err := models.UserSignIn(form.UserName, form.Password)
143+
form := web.GetForm(ctx).(*forms.SignInForm)
144+
u, err := auth.UserSignIn(form.UserName, form.Password)
145145

146146
response := make(map[string]string)
147147
if err != nil {

routers/web/web.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ func RegisterRoutes(m *web.Route) {
263263
// ***** START: User *****
264264
m.Group("/user", func() {
265265
m.Group("/kitspace", func() {
266-
m.Post("/sign_up", bindIgnErr(auth.RegisterForm{}), user.KitspaceSignUp)
267-
m.Post("/sign_in", bindIgnErr(auth.SignInForm{}), user.KitspaceSignIn)
266+
m.Post("/sign_up", bindIgnErr(forms.RegisterForm{}), user.KitspaceSignUp)
267+
m.Post("/sign_in", bindIgnErr(forms.SignInForm{}), user.KitspaceSignIn)
268268
})
269269

270270
m.Get("/login", user.SignIn)

0 commit comments

Comments
 (0)