diff options
author | Lanre Adelowo <adelowomailbox@gmail.com> | 2019-02-05 12:38:11 +0100 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2019-02-05 13:38:11 +0200 |
commit | 539079122418c485347506110bef232c99a75d37 (patch) | |
tree | a00aa1ae7a7bb0e82dcae461b7c53c3921731cb2 /routers/repo/issue_stopwatch.go | |
parent | 5bd594c85883d713f9d94f6e93cd8f08b253b369 (diff) | |
download | gitea-539079122418c485347506110bef232c99a75d37.tar.gz gitea-539079122418c485347506110bef232c99a75d37.zip |
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
Diffstat (limited to 'routers/repo/issue_stopwatch.go')
-rw-r--r-- | routers/repo/issue_stopwatch.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/routers/repo/issue_stopwatch.go b/routers/repo/issue_stopwatch.go index a7d6ed39cc..28105dfe03 100644 --- a/routers/repo/issue_stopwatch.go +++ b/routers/repo/issue_stopwatch.go @@ -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) } |