Skip to content

Commit 0ccd672

Browse files
committed
stop timer for issues that are closed via commits too..Not just the 'close' UI button
1 parent e1ae7d2 commit 0ccd672

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

models/action.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,15 +491,27 @@ func changeIssueStatus(repo *Repository, doer *User, ref string, refMarked map[i
491491
return nil
492492
}
493493

494+
stopTimerIfAvailable := func(doer *User, issue *Issue) error {
495+
496+
if StopwatchExists(doer.ID, issue.ID) {
497+
if err := CreateOrStopIssueStopwatch(doer, issue); err != nil {
498+
return err
499+
}
500+
}
501+
502+
return nil
503+
}
504+
494505
issue.Repo = repo
495506
if err = issue.ChangeStatus(doer, status); err != nil {
496507
// Don't return an error when dependencies are open as this would let the push fail
497508
if IsErrDependenciesLeft(err) {
498-
return nil
509+
return stopTimerIfAvailable(doer, issue)
499510
}
500511
return err
501512
}
502-
return nil
513+
514+
return stopTimerIfAvailable(doer, issue)
503515
}
504516

505517
// UpdateIssuesCommit checks if issues are manipulated by commit message.

0 commit comments

Comments
 (0)