Merge 4f6ae0ffe7
into d0fef4395f
This commit is contained in:
commit
8576630c10
|
@ -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 will be stopped automatically when this issue gets 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`
|
||||
|
|
|
@ -1068,6 +1068,12 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) {
|
|||
return
|
||||
}
|
||||
} else {
|
||||
|
||||
if err := stopTimerIfAvailable(ctx.User, issue); err != nil {
|
||||
ctx.ServerError("CreateOrStopIssueStopwatch", err)
|
||||
return
|
||||
}
|
||||
|
||||
log.Trace("Issue [%d] status changed to closed: %v", issue.ID, issue.IsClosed)
|
||||
|
||||
notification.Service.NotifyIssue(issue, ctx.User.ID)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -546,12 +546,28 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) {
|
|||
return
|
||||
}
|
||||
|
||||
if err := stopTimerIfAvailable(ctx.User, issue); err != nil {
|
||||
ctx.ServerError("CreateOrStopIssueStopwatch", err)
|
||||
return
|
||||
}
|
||||
|
||||
notification.Service.NotifyIssue(pr.Issue, ctx.User.ID)
|
||||
|
||||
log.Trace("Pull request merged: %d", pr.ID)
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pr.Index))
|
||||
}
|
||||
|
||||
func stopTimerIfAvailable(user *models.User, issue *models.Issue) error {
|
||||
|
||||
if models.StopwatchExists(user.ID, issue.ID) {
|
||||
if err := models.CreateOrStopIssueStopwatch(user, issue); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ParseCompareInfo parse compare info between two commit for preparing pull request
|
||||
func ParseCompareInfo(ctx *context.Context) (*models.User, *models.Repository, *git.Repository, *git.PullRequestInfo, string, string) {
|
||||
baseRepo := ctx.Repo.Repository
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
{{ template "base/alert" }}
|
||||
{{range .Issue.Comments}}
|
||||
{{ $createdStr:= TimeSinceUnix .CreatedUnix $.Lang }}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user