mirror of
https://github.com/go-gitea/gitea
synced 2025-08-13 13:08:19 +00:00
Backport #18045 The current code unfortunately requires that `action` be a reserved repository name as it prevents posts to change the settings for action repositories. However, we can simply change action handler to work on POST /{username} instead. Fix #18037 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
@@ -321,7 +321,7 @@ func Action(ctx *context.Context) {
|
||||
}
|
||||
|
||||
var err error
|
||||
switch ctx.Params(":action") {
|
||||
switch ctx.Query("action") {
|
||||
case "follow":
|
||||
err = models.FollowUser(ctx.User.ID, u.ID)
|
||||
case "unfollow":
|
||||
@@ -329,7 +329,7 @@ func Action(ctx *context.Context) {
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
ctx.ServerError(fmt.Sprintf("Action (%s)", ctx.Params(":action")), err)
|
||||
ctx.ServerError(fmt.Sprintf("Action (%s)", ctx.Query("action")), err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@@ -461,9 +461,7 @@ func RegisterRoutes(m *web.Route) {
|
||||
m.Get("/attachments/{uuid}", repo.GetAttachment)
|
||||
}, ignSignIn)
|
||||
|
||||
m.Group("/{username}", func() {
|
||||
m.Post("/action/{action}", user.Action)
|
||||
}, reqSignIn)
|
||||
m.Post("/{username}", reqSignIn, user.Action)
|
||||
|
||||
if !setting.IsProd() {
|
||||
m.Get("/template/*", dev.TemplatePreview)
|
||||
|
Reference in New Issue
Block a user