Watch backend
This commit is contained in:
parent
8b0f421eb5
commit
a922c3ff6a
7 changed files with 44 additions and 13 deletions
|
@ -208,3 +208,25 @@ func Pulls(ctx *middleware.Context) {
|
|||
ctx.Data["IsRepoToolbarPulls"] = true
|
||||
ctx.HTML(200, "repo/pulls", ctx.Data)
|
||||
}
|
||||
|
||||
func Action(ctx *middleware.Context, params martini.Params) {
|
||||
var err error
|
||||
switch params["action"] {
|
||||
case "watch":
|
||||
err = models.WatchRepo(ctx.User.Id, ctx.Repo.Repository.Id, true)
|
||||
case "unwatch":
|
||||
err = models.WatchRepo(ctx.User.Id, ctx.Repo.Repository.Id, false)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Error("repo.Action(%s): %v", params["action"], err)
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"ok": false,
|
||||
"err": err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"ok": true,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -93,7 +93,6 @@ func SettingSSHKeys(ctx *middleware.Context, form auth.AddSSHKeyForm) {
|
|||
if ctx.Req.Method == "DELETE" || ctx.Query("_method") == "DELETE" {
|
||||
id, err := strconv.ParseInt(ctx.Query("id"), 10, 64)
|
||||
if err != nil {
|
||||
ctx.Data["ErrorMsg"] = err
|
||||
log.Error("ssh.DelPublicKey: %v", err)
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"ok": false,
|
||||
|
@ -107,7 +106,6 @@ func SettingSSHKeys(ctx *middleware.Context, form auth.AddSSHKeyForm) {
|
|||
}
|
||||
|
||||
if err = models.DeletePublicKey(k); err != nil {
|
||||
ctx.Data["ErrorMsg"] = err
|
||||
log.Error("ssh.DelPublicKey: %v", err)
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"ok": false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue