diff options
-rw-r--r-- | routes/repo/repo.go | 8 | ||||
-rw-r--r-- | templates/repo/user_cards.tmpl | 10 |
2 files changed, 17 insertions, 1 deletions
diff --git a/routes/repo/repo.go b/routes/repo/repo.go index 00dbc2f8..96a8b45d 100644 --- a/routes/repo/repo.go +++ b/routes/repo/repo.go @@ -235,7 +235,13 @@ func Action(c *context.Context) { case "watch": err = models.WatchRepo(c.User.ID, c.Repo.Repository.ID, true) case "unwatch": - err = models.WatchRepo(c.User.ID, c.Repo.Repository.ID, false) + if userID := c.QueryInt64("user_id"); userID != 0 { + if c.User.IsAdmin { + err = models.WatchRepo(userID, c.Repo.Repository.ID, false) + } + } else { + err = models.WatchRepo(c.User.ID, c.Repo.Repository.ID, false) + } case "star": err = models.StarRepo(c.User.ID, c.Repo.Repository.ID, true) case "unstar": diff --git a/templates/repo/user_cards.tmpl b/templates/repo/user_cards.tmpl index a29ea997..bb6c6348 100644 --- a/templates/repo/user_cards.tmpl +++ b/templates/repo/user_cards.tmpl @@ -19,6 +19,16 @@ <span class="octicon octicon-clock"></span> {{$.i18n.Tr "user.join_on"}} {{DateFmtShort .Created}} {{end}} </div> + + {{if $.IsAdmin}} + <form class="display inline" action="{{$.RepoLink}}/action/unwatch?redirect_to={{$.Link}}" method="POST"> + {{$.CSRFTokenHTML}} + <input type="hidden" name="user_id" value="{{.ID}}"> + <div class="ui labeled button" tabindex="0"> + <button class="ui red small button">{{$.i18n.Tr "repo.unwatch"}}</button> + </div> + </form> + {{end}} </li> {{end}} </ul> |