1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Merge pull request #560 from evolvedlight/master

First cut of fork repo
This commit is contained in:
无闻
2014-10-18 23:59:36 -04:00
5 changed files with 168 additions and 5 deletions

View File

@@ -217,6 +217,21 @@ func Action(ctx *middleware.Context) {
err = models.StarRepo(ctx.User.Id, ctx.Repo.Repository.Id, true)
case "unstar":
err = models.StarRepo(ctx.User.Id, ctx.Repo.Repository.Id, false)
case "fork":
repo, error := models.ForkRepository(ctx.User, ctx.Repo.Repository)
if error != nil {
log.Error(4, "Action(%s): %v", ctx.Params(":action"), error)
ctx.JSON(200, map[string]interface{}{
"ok": false,
"err": error.Error(),
})
return
}
if error == nil {
ctx.Redirect(setting.AppSubUrl + "/" + repo.Owner.Name + "/" + repo.Name)
return
}
case "desc":
if !ctx.Repo.IsOwner {
ctx.Error(404)