diff --git a/routers/web/repo/issue_view.go b/routers/web/repo/issue_view.go index 5774903c19a..a5bed6bba05 100644 --- a/routers/web/repo/issue_view.go +++ b/routers/web/repo/issue_view.go @@ -418,7 +418,7 @@ func ViewIssue(ctx *context.Context) { return user_service.CanBlockUser(ctx, ctx.Doer, blocker, blockee) } - if !setting.IsProd && issue.PullRequest != nil && !issue.PullRequest.IsChecking() && prViewInfo.MergeBoxData != nil { + if !setting.IsProd && issue.PullRequest != nil && prViewInfo.MergeBoxData != nil && prViewInfo.MergeBoxData.ReloadingInterval == 0 { prViewInfo.MergeBoxData.ReloadingInterval = 1 // in dev env, force using the reloading logic to make sure it won't break } @@ -919,7 +919,6 @@ func (prInfo *pullRequestViewInfo) prepareMergeBox(ctx *context.Context, issue * } } - data.ReloadingInterval = util.Iif(pull.IsChecking(), 2000, 0) data.ShowMergeInstructions = canWriteToHeadRepo data.ShowPullCommands = pull.HeadRepo != nil && !pull.HasMerged && !issue.IsClosed @@ -941,6 +940,10 @@ func (prInfo *pullRequestViewInfo) prepareMergeBox(ctx *context.Context, issue * prConfig := issue.Repo.MustGetUnit(ctx, unit.TypePullRequests).PullRequestsConfig() data.AutodetectManualMerge = prConfig.AutodetectManualMerge + needRefreshMergeBox := pull.IsChecking() + needRefreshMergeBox = needRefreshMergeBox || (data.StatusCheckData != nil && data.StatusCheckData.pullCommitStatusState.IsPending()) + data.ReloadingInterval = util.Iif(needRefreshMergeBox, 5000, 0) + // Only show the merge box if the PR is not merged, or the branch is deletable. // Otherwise, there is nothing to do, because the PR view page already contains enough information. data.ShowMergeBox = !pull.HasMerged || data.IsPullBranchDeletable diff --git a/tests/integration/pull_status_test.go b/tests/integration/pull_status_test.go index a6305299699..b13eb7f2c23 100644 --- a/tests/integration/pull_status_test.go +++ b/tests/integration/pull_status_test.go @@ -210,7 +210,7 @@ func TestPullStatusDelayCheck(t *testing.T) { }) assert.Equal(t, issues.PullRequestStatusChecking, issue3.PullRequest.Status) assert.Zero(t, checkedPrID) - assertReloadingInterval(t, "2000") // the PR status is "checking", so try to reload the merge box + assertReloadingInterval(t, "5000") // the PR status is "checking", so try to reload the merge box // view a PR with status=checking, it starts the real check issue3, checkedPrID = run(t, func(t *testing.T) {