mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-20 08:00:52 +00:00
fix: remove artificial delay for PR update (#7773)
Some checks failed
/ release (push) Has been cancelled
testing / backend-checks (push) Has been cancelled
testing / frontend-checks (push) Has been cancelled
testing / test-unit (push) Has been cancelled
testing / test-e2e (push) Has been cancelled
testing / test-remote-cacher (redis) (push) Has been cancelled
testing / test-remote-cacher (valkey) (push) Has been cancelled
testing / test-remote-cacher (garnet) (push) Has been cancelled
testing / test-remote-cacher (redict) (push) Has been cancelled
testing / test-mysql (push) Has been cancelled
testing / test-pgsql (push) Has been cancelled
testing / test-sqlite (push) Has been cancelled
testing / security-check (push) Has been cancelled
Some checks failed
/ release (push) Has been cancelled
testing / backend-checks (push) Has been cancelled
testing / frontend-checks (push) Has been cancelled
testing / test-unit (push) Has been cancelled
testing / test-e2e (push) Has been cancelled
testing / test-remote-cacher (redis) (push) Has been cancelled
testing / test-remote-cacher (valkey) (push) Has been cancelled
testing / test-remote-cacher (garnet) (push) Has been cancelled
testing / test-remote-cacher (redict) (push) Has been cancelled
testing / test-mysql (push) Has been cancelled
testing / test-pgsql (push) Has been cancelled
testing / test-sqlite (push) Has been cancelled
testing / security-check (push) Has been cancelled
- I was not able to find a reasoning in the pull request (https://github.com/go-gitea/gitea/pull/9784) for the existence of this `time.Sleep`. The best I could come up with during manual testing is that there's a brief moment where 'this pull request is missing fork information' is shown, this was caused by an incorrect condition. - Added integration test. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7773 Reviewed-by: 0ko <0ko@noreply.codeberg.org> Reviewed-by: Otto <otto@codeberg.org> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
parent
8b03d3260d
commit
4a57f73072
3 changed files with 18 additions and 4 deletions
|
@ -65,6 +65,7 @@
|
||||||
merge_base: 985f0301dba5e7b34be866819cd15ad3d8f508ee
|
merge_base: 985f0301dba5e7b34be866819cd15ad3d8f508ee
|
||||||
has_merged: false
|
has_merged: false
|
||||||
allow_maintainer_edit: true
|
allow_maintainer_edit: true
|
||||||
|
commits_behind: 1
|
||||||
|
|
||||||
-
|
-
|
||||||
id: 6
|
id: 6
|
||||||
|
|
|
@ -14,7 +14,6 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"forgejo.org/models"
|
"forgejo.org/models"
|
||||||
activities_model "forgejo.org/models/activities"
|
activities_model "forgejo.org/models/activities"
|
||||||
|
@ -728,7 +727,7 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
|
||||||
ctx.Data["HeadBranchCommitID"] = headBranchSha
|
ctx.Data["HeadBranchCommitID"] = headBranchSha
|
||||||
ctx.Data["PullHeadCommitID"] = sha
|
ctx.Data["PullHeadCommitID"] = sha
|
||||||
|
|
||||||
if pull.HeadRepo == nil || !headBranchExist || (!pull.Issue.IsClosed && (headBranchSha != sha)) {
|
if pull.HeadRepo == nil || !headBranchExist || (!pull.Issue.IsClosed && !pull.IsChecking() && (headBranchSha != sha)) {
|
||||||
ctx.Data["IsPullRequestBroken"] = true
|
ctx.Data["IsPullRequestBroken"] = true
|
||||||
if pull.IsSameRepo() {
|
if pull.IsSameRepo() {
|
||||||
ctx.Data["HeadTarget"] = pull.HeadBranch
|
ctx.Data["HeadTarget"] = pull.HeadBranch
|
||||||
|
@ -1208,8 +1207,6 @@ func UpdatePullRequest(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
time.Sleep(1 * time.Second)
|
|
||||||
|
|
||||||
ctx.Flash.Success(ctx.Tr("repo.pulls.update_branch_success"))
|
ctx.Flash.Success(ctx.Tr("repo.pulls.update_branch_success"))
|
||||||
ctx.Redirect(issue.Link())
|
ctx.Redirect(issue.Link())
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,3 +273,19 @@ func createOutdatedPR(t *testing.T, actor, forkOrg *user_model.User) *issues_mod
|
||||||
|
|
||||||
return issue.PullRequest
|
return issue.PullRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestStatusDuringUpdate(t *testing.T) {
|
||||||
|
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||||
|
session := loginUser(t, "user2")
|
||||||
|
|
||||||
|
// Adjust this pull request to be in the conflict checker and having a head
|
||||||
|
// branch that is pointing to the an incorrect commit ID.
|
||||||
|
_, err := db.GetEngine(t.Context()).Cols("status", "head_branch").Update(&issues_model.PullRequest{ID: 5, Status: issues_model.PullRequestStatusChecking, HeadBranch: "master"})
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
resp := session.MakeRequest(t, NewRequest(t, "GET", "/user2/repo1/pulls/5"), http.StatusOK)
|
||||||
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
|
|
||||||
|
assert.Contains(t, htmlDoc.Find(".merge-section .item").Text(), "Merge conflict checking is in progress. Try again in few moments.")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue