use ctx.Flash as per @bkcsoft comment

This commit is contained in:
Lanre Adelowo 2018-07-14 17:22:10 +01:00
parent dff2c69a36
commit bb7b73e46f
3 changed files with 13 additions and 0 deletions

View File

@ -753,6 +753,7 @@ issues.tracker = Time Tracker
issues.start_tracking_short = Start
issues.start_tracking = Start Time Tracking
issues.start_tracking_history = `started working %s`
issues.tracker_auto_close = Timer would be stopped automatically when this issue is closed
issues.tracking_already_started = `You have already started time tracking on this <a href="%s">issue</a>!`
issues.stop_tracking = Stop
issues.stop_tracking_history = `stopped working %s`

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)
}

View File

@ -1,3 +1,4 @@
{{ template "base/alert" }}
{{range .Issue.Comments}}
{{ $createdStr:= TimeSinceUnix .CreatedUnix $.Lang }}