From 802efa342dbdf51543c8583380837e296033da2e Mon Sep 17 00:00:00 2001 From: Zettat123 Date: Fri, 26 Apr 2024 17:07:09 +0800 Subject: [PATCH] remove stopTimerIfAvailable --- routers/web/repo/issue.go | 7 ------- routers/web/repo/pull.go | 17 ----------------- 2 files changed, 24 deletions(-) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 8523aadcb1..061a155fbf 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -3080,13 +3080,6 @@ func NewComment(ctx *context.Context) { } return } - } else { - if err := stopTimerIfAvailable(ctx, ctx.Doer, issue); err != nil { - ctx.ServerError("CreateOrStopIssueStopwatch", err) - return - } - - log.Trace("Issue [%d] status changed to closed: %v", issue.ID, issue.IsClosed) } } } diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index acdba4bcdc..d3ff5522d5 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -1153,13 +1153,6 @@ func MergePullRequest(ctx *context.Context) { } log.Trace("Pull request merged: %d", pr.ID) - if err := stopTimerIfAvailable(ctx, ctx.Doer, issue); err != nil { - ctx.ServerError("stopTimerIfAvailable", err) - return - } - - log.Trace("Pull request merged: %d", pr.ID) - if form.DeleteBranchAfterMerge { // Don't cleanup when other pr use this branch as head branch exist, err := issues_model.HasUnmergedPullRequestsByHeadInfo(ctx, pr.HeadRepoID, pr.HeadBranch) @@ -1209,16 +1202,6 @@ func CancelAutoMergePullRequest(ctx *context.Context) { ctx.Redirect(fmt.Sprintf("%s/pulls/%d", ctx.Repo.RepoLink, issue.Index)) } -func stopTimerIfAvailable(ctx *context.Context, user *user_model.User, issue *issues_model.Issue) error { - if issues_model.StopwatchExists(ctx, user.ID, issue.ID) { - if err := issues_model.CreateOrStopIssueStopwatch(ctx, user, issue); err != nil { - return err - } - } - - return nil -} - // CompareAndPullRequestPost response for creating pull request func CompareAndPullRequestPost(ctx *context.Context) { form := web.GetForm(ctx).(*forms.CreateIssueForm)