forked from kevadesu/forgejo
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:
parent
5bd594c858
commit
5390791224
6 changed files with 49 additions and 2 deletions
|
@ -491,15 +491,27 @@ func changeIssueStatus(repo *Repository, doer *User, ref string, refMarked map[i
|
|||
return nil
|
||||
}
|
||||
|
||||
stopTimerIfAvailable := func(doer *User, issue *Issue) error {
|
||||
|
||||
if StopwatchExists(doer.ID, issue.ID) {
|
||||
if err := CreateOrStopIssueStopwatch(doer, issue); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
issue.Repo = repo
|
||||
if err = issue.ChangeStatus(doer, status); err != nil {
|
||||
// Don't return an error when dependencies are open as this would let the push fail
|
||||
if IsErrDependenciesLeft(err) {
|
||||
return nil
|
||||
return stopTimerIfAvailable(doer, issue)
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
return stopTimerIfAvailable(doer, issue)
|
||||
}
|
||||
|
||||
// UpdateIssuesCommit checks if issues are manipulated by commit message.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue