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

Automatically clear stopwatch on merging a PR (#4327)

* Don't display buttons if there are no notices

* clear stopwatch on merging a PR

* remove redundant gt check

* use ctx.Flash as per @bkcsoft comment

* stop timer on closing issues/PRs too

* updated translation as per review

* redirect to login page after successfully activating account

* remove unrelated changes

* stop timer for issues that are closed via commits too..Not just the 'close' UI button
This commit is contained in:
Lanre Adelowo
2019-02-05 12:38:11 +01:00
committed by Lauris BH
parent 5bd594c858
commit 5390791224
6 changed files with 49 additions and 2 deletions

View File

@@ -17,6 +17,13 @@ func IssueStopwatch(c *context.Context) {
if c.Written() {
return
}
var showSuccessMessage bool
if !models.StopwatchExists(c.User.ID, issue.ID) {
showSuccessMessage = true
}
if !c.Repo.CanUseTimetracker(issue, c.User) {
c.NotFound("CanUseTimetracker", nil)
return
@@ -27,6 +34,10 @@ func IssueStopwatch(c *context.Context) {
return
}
if showSuccessMessage {
c.Flash.Success(c.Tr("repo.issues.tracker_auto_close"))
}
url := issue.HTMLURL()
c.Redirect(url, http.StatusSeeOther)
}