loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request '[gitea] week 2024-35 cherry pick (gitea/main -> forgejo)' (#5109) from algernon/wcp/2024-35 into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5109
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>

+196 -29
+1 -1
models/fixtures/repository.yml
··· 26 26 fork_id: 0 27 27 is_template: false 28 28 template_id: 0 29 - size: 7320 29 + size: 7597 30 30 is_fsck_enabled: true 31 31 close_issues_via_commit_in_any_branch: false 32 32
+3 -3
modules/migration/pullrequest.go
··· 45 45 46 46 // IsForkPullRequest returns true if the pull request from a forked repository but not the same repository 47 47 func (p *PullRequest) IsForkPullRequest() bool { 48 - return p.Head.RepoPath() != p.Base.RepoPath() 48 + return p.Head.RepoFullName() != p.Base.RepoFullName() 49 49 } 50 50 51 51 // GetGitRefName returns pull request relative path to head ··· 62 62 OwnerName string `yaml:"owner_name"` 63 63 } 64 64 65 - // RepoPath returns pull request repo path 66 - func (p PullRequestBranch) RepoPath() string { 65 + // RepoFullName returns pull request repo full name 66 + func (p PullRequestBranch) RepoFullName() string { 67 67 return fmt.Sprintf("%s/%s", p.OwnerName, p.RepoName) 68 68 } 69 69
+2
release-notes/5109.md
··· 1 + fix: [commit](https://codeberg.org/forgejo/forgejo/commit/3ade4d9b2bfa6ae84a1ded932907a53060565575) Don't return 500 if mirror url contains special chars 2 + fix: [commit](https://codeberg.org/forgejo/forgejo/commit/dda53569b1b70507469fc296881eec89606ab9c3) Fix agit automerge
+3
routers/web/auth/linkaccount.go
··· 40 40 ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey 41 41 ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey 42 42 ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL 43 + ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey 43 44 ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration 44 45 ctx.Data["AllowOnlyInternalRegistration"] = setting.Service.AllowOnlyInternalRegistration 45 46 ctx.Data["ShowRegistrationButton"] = false ··· 128 129 ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey 129 130 ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey 130 131 ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL 132 + ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey 131 133 ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration 132 134 ctx.Data["ShowRegistrationButton"] = false 133 135 ··· 215 217 ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey 216 218 ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey 217 219 ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL 220 + ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey 218 221 ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration 219 222 ctx.Data["ShowRegistrationButton"] = false 220 223
+1
routers/web/auth/openid.go
··· 307 307 ctx.Data["RecaptchaURL"] = setting.Service.RecaptchaURL 308 308 ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey 309 309 ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL 310 + ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey 310 311 ctx.Data["OpenID"] = oid 311 312 userName, _ := ctx.Session.Get("openid_determined_username").(string) 312 313 if userName != "" {
+4 -2
routers/web/repo/setting/setting.go
··· 481 481 } 482 482 remoteAddress, err := util.SanitizeURL(address) 483 483 if err != nil { 484 - ctx.ServerError("SanitizeURL", err) 484 + ctx.Data["Err_MirrorAddress"] = true 485 + handleSettingRemoteAddrError(ctx, err, form) 485 486 return 486 487 } 487 488 pullMirror.RemoteAddress = remoteAddress ··· 667 668 668 669 remoteAddress, err := util.SanitizeURL(address) 669 670 if err != nil { 670 - ctx.ServerError("SanitizeURL", err) 671 + ctx.Data["Err_PushMirrorAddress"] = true 672 + handleSettingRemoteAddrError(ctx, err, form) 671 673 return 672 674 } 673 675
+1 -1
services/actions/notifier.go
··· 396 396 // Add to hook queue for created repo after session commit. 397 397 if u.IsOrganization() { 398 398 newNotifyInput(repo, doer, webhook_module.HookEventRepository). 399 - WithRef(oldRepo.DefaultBranch). 399 + WithRef(git.RefNameFromBranch(oldRepo.DefaultBranch).String()). 400 400 WithPayload(&api.RepositoryPayload{ 401 401 Action: api.HookRepoCreated, 402 402 Repository: convert.ToRepo(ctx, repo, access_model.Permission{AccessMode: perm_model.AccessModeOwner}),
+15 -10
services/actions/notifier_helper.go
··· 69 69 Event webhook_module.HookEventType 70 70 71 71 // optional 72 - Ref string 72 + Ref git.RefName 73 73 Payload api.Payloader 74 74 PullRequest *issues_model.PullRequest 75 75 } ··· 93 93 } 94 94 95 95 func (input *notifyInput) WithRef(ref string) *notifyInput { 96 - input.Ref = ref 96 + input.Ref = git.RefName(ref) 97 97 return input 98 98 } 99 99 ··· 105 105 func (input *notifyInput) WithPullRequest(pr *issues_model.PullRequest) *notifyInput { 106 106 input.PullRequest = pr 107 107 if input.Ref == "" { 108 - input.Ref = pr.GetGitRefName() 108 + input.Ref = git.RefName(pr.GetGitRefName()) 109 109 } 110 110 return input 111 111 } ··· 148 148 defer gitRepo.Close() 149 149 150 150 ref := input.Ref 151 - if ref != input.Repo.DefaultBranch && actions_module.IsDefaultBranchWorkflow(input.Event) { 151 + if ref.BranchName() != input.Repo.DefaultBranch && actions_module.IsDefaultBranchWorkflow(input.Event) { 152 152 if ref != "" { 153 153 log.Warn("Event %q should only trigger workflows on the default branch, but its ref is %q. Will fall back to the default branch", 154 154 input.Event, ref) 155 155 } 156 - ref = input.Repo.DefaultBranch 156 + ref = git.RefNameFromBranch(input.Repo.DefaultBranch) 157 157 } 158 158 if ref == "" { 159 159 log.Warn("Ref of event %q is empty, will fall back to the default branch", input.Event) 160 - ref = input.Repo.DefaultBranch 160 + ref = git.RefNameFromBranch(input.Repo.DefaultBranch) 161 + } 162 + 163 + commitID, err := gitRepo.GetRefCommitID(ref.String()) 164 + if err != nil { 165 + return fmt.Errorf("gitRepo.GetRefCommitID: %w", err) 161 166 } 162 167 163 168 // Get the commit object for the ref 164 - commit, err := gitRepo.GetCommit(ref) 169 + commit, err := gitRepo.GetCommit(commitID) 165 170 if err != nil { 166 171 return fmt.Errorf("gitRepo.GetCommit: %w", err) 167 172 } ··· 177 182 178 183 var detectedWorkflows []*actions_module.DetectedWorkflow 179 184 actionsConfig := input.Repo.MustGetUnit(ctx, unit_model.TypeActions).ActionsConfig() 180 - shouldDetectSchedules := input.Event == webhook_module.HookEventPush && git.RefName(input.Ref).BranchName() == input.Repo.DefaultBranch 185 + shouldDetectSchedules := input.Event == webhook_module.HookEventPush && input.Ref.BranchName() == input.Repo.DefaultBranch 181 186 workflows, schedules, err := actions_module.DetectWorkflows(gitRepo, commit, 182 187 input.Event, 183 188 input.Payload, ··· 235 240 } 236 241 237 242 if shouldDetectSchedules { 238 - if err := handleSchedules(ctx, schedules, commit, input, ref); err != nil { 243 + if err := handleSchedules(ctx, schedules, commit, input, ref.String()); err != nil { 239 244 return err 240 245 } 241 246 } 242 247 243 - return handleWorkflows(ctx, detectedWorkflows, commit, input, ref) 248 + return handleWorkflows(ctx, detectedWorkflows, commit, input, ref.String()) 244 249 } 245 250 246 251 func SkipPullRequestEvent(ctx context.Context, event webhook_module.HookEventType, repoID int64, commitSHA string) bool {
+15 -3
services/automerge/automerge.go
··· 245 245 defer headGitRepo.Close() 246 246 } 247 247 248 - headBranchExist := headGitRepo.IsBranchExist(pr.HeadBranch) 249 - if pr.HeadRepo == nil || !headBranchExist { 250 - log.Warn("Head branch of auto merge %-v does not exist [HeadRepoID: %d, Branch: %s]", pr, pr.HeadRepoID, pr.HeadBranch) 248 + switch pr.Flow { 249 + case issues_model.PullRequestFlowGithub: 250 + headBranchExist := headGitRepo.IsBranchExist(pr.HeadBranch) 251 + if pr.HeadRepo == nil || !headBranchExist { 252 + log.Warn("Head branch of auto merge %-v does not exist [HeadRepoID: %d, Branch: %s]", pr, pr.HeadRepoID, pr.HeadBranch) 253 + return 254 + } 255 + case issues_model.PullRequestFlowAGit: 256 + headBranchExist := git.IsReferenceExist(ctx, baseGitRepo.Path, pr.GetGitRefName()) 257 + if !headBranchExist { 258 + log.Warn("Head branch of auto merge %-v does not exist [HeadRepoID: %d, Branch(Agit): %s]", pr, pr.HeadRepoID, pr.HeadBranch) 259 + return 260 + } 261 + default: 262 + log.Error("wrong flow type %d", pr.Flow) 251 263 return 252 264 } 253 265
+11 -7
templates/repo/branch/list.tmpl
··· 20 20 <tr> 21 21 <td> 22 22 <div class="flex-text-block"> 23 - {{if .DefaultBranchBranch.IsProtected}}{{svg "octicon-shield-lock"}}{{end}} 24 23 <a class="gt-ellipsis" href="{{.RepoLink}}/src/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}">{{.DefaultBranchBranch.DBBranch.Name}}</a> 25 - <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DefaultBranchBranch.DBBranch.Name}}">{{svg "octicon-copy" 14}}</button> 24 + {{if .DefaultBranchBranch.IsProtected}} 25 + <span data-tooltip-content="{{ctx.Locale.Tr "repo.settings.protected_branch"}}">{{svg "octicon-shield-lock"}}</span> 26 + {{end}} 27 + <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DefaultBranchBranch.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_branch"}}">{{svg "octicon-copy" 14}}</button> 26 28 {{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DefaultBranchBranch.DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DefaultBranchBranch.DBBranch.CommitID)}} 27 29 </div> 28 30 <p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.DBBranch.CommitID}}">{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .DefaultBranchBranch.DBBranch.CommitMessage (.Repository.ComposeMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated" (TimeSince .DefaultBranchBranch.DBBranch.CommitTime.AsTime ctx.Locale)}} {{if .DefaultBranchBranch.DBBranch.Pusher}} &nbsp;{{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}</p> ··· 39 41 </button> 40 42 {{end}} 41 43 {{if .EnableFeed}} 42 - <a role="button" class="btn interact-bg tw-p-2" href="{{$.FeedURL}}/rss/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}">{{svg "octicon-rss"}}</a> 44 + <a role="button" class="btn interact-bg tw-p-2" href="{{$.FeedURL}}/rss/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss"}}</a> 43 45 {{end}} 44 46 {{if not $.DisableDownloadSourceArchives}} 45 47 <div class="ui dropdown btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.download" ($.DefaultBranchBranch.DBBranch.Name)}}"> ··· 88 90 {{if .DBBranch.IsDeleted}} 89 91 <div class="flex-text-block"> 90 92 <span class="gt-ellipsis">{{.DBBranch.Name}}</span> 91 - <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DBBranch.Name}}">{{svg "octicon-copy" 14}}</button> 93 + <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_branch"}}">{{svg "octicon-copy" 14}}</button> 92 94 </div> 93 95 <p class="info">{{ctx.Locale.Tr "repo.branch.deleted_by" .DBBranch.DeletedBy.Name}} {{TimeSinceUnix .DBBranch.DeletedUnix ctx.Locale}}</p> 94 96 {{else}} 95 97 <div class="flex-text-block"> 96 - {{if .IsProtected}}{{svg "octicon-shield-lock"}}{{end}} 97 98 <a class="gt-ellipsis" href="{{$.RepoLink}}/src/branch/{{PathEscapeSegments .DBBranch.Name}}">{{.DBBranch.Name}}</a> 98 - <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DBBranch.Name}}">{{svg "octicon-copy" 14}}</button> 99 + {{if .IsProtected}} 100 + <span data-tooltip-content="{{ctx.Locale.Tr "repo.settings.protected_branch"}}">{{svg "octicon-shield-lock"}}</span> 101 + {{end}} 102 + <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_branch"}}">{{svg "octicon-copy" 14}}</button> 99 103 {{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DBBranch.CommitID)}} 100 104 </div> 101 105 <p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{$.RepoLink}}/commit/{{PathEscape .DBBranch.CommitID}}">{{ShortSha .DBBranch.CommitID}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .DBBranch.CommitMessage ($.Repository.ComposeMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated" (TimeSince .DBBranch.CommitTime.AsTime ctx.Locale)}} {{if .DBBranch.Pusher}} &nbsp;{{template "shared/user/avatarlink" dict "user" .DBBranch.Pusher}} &nbsp;{{template "shared/user/namelink" .DBBranch.Pusher}}{{end}}</p> ··· 158 162 </button> 159 163 {{end}} 160 164 {{if $.EnableFeed}} 161 - <a role="button" class="btn interact-bg tw-p-2" href="{{$.FeedURL}}/rss/branch/{{PathEscapeSegments .DBBranch.Name}}">{{svg "octicon-rss"}}</a> 165 + <a role="button" class="btn interact-bg tw-p-2" href="{{$.FeedURL}}/rss/branch/{{PathEscapeSegments .DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss"}}</a> 162 166 {{end}} 163 167 {{if and (not .DBBranch.IsDeleted) (not $.DisableDownloadSourceArchives)}} 164 168 <div class="ui dropdown btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.download" (.DBBranch.Name)}}">
+7
tests/gitea-repositories-meta/user2/repo1.git/hooks/proc-receive
··· 1 + #!/usr/bin/env bash 2 + ORI_DIR=`pwd` 3 + SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) 4 + cd "$ORI_DIR" 5 + for i in `ls "$SHELL_FOLDER/proc-receive.d"`; do 6 + sh "$SHELL_FOLDER/proc-receive.d/$i" 7 + done
+2
tests/gitea-repositories-meta/user2/repo1.git/hooks/proc-receive.d/gitea
··· 1 + #!/usr/bin/env bash 2 + "$GITEA_ROOT/gitea" hook --config="$GITEA_ROOT/$GITEA_CONF" proc-receive
+2 -2
tests/integration/actions_trigger_test.go
··· 376 376 Title: "add workflow", 377 377 RepoID: repo.ID, 378 378 Event: "delete", 379 - Ref: "main", 379 + Ref: "refs/heads/main", 380 380 WorkflowID: "createdelete.yml", 381 381 CommitSHA: branch.CommitID, 382 382 }) ··· 391 391 Title: "add workflow", 392 392 RepoID: repo.ID, 393 393 Event: "delete", 394 - Ref: "main", 394 + Ref: "refs/heads/main", 395 395 WorkflowID: "createdelete.yml", 396 396 CommitSHA: branch.CommitID, 397 397 })
+129
tests/integration/pull_merge_test.go
··· 1021 1021 unittest.AssertNotExistsBean(t, &pull_model.AutoMerge{PullID: pr.ID}) 1022 1022 }) 1023 1023 } 1024 + 1025 + func TestPullAutoMergeAfterCommitStatusSucceedAndApprovalForAgitFlow(t *testing.T) { 1026 + onGiteaRun(t, func(t *testing.T, u *url.URL) { 1027 + // create a pull request 1028 + baseAPITestContext := NewAPITestContext(t, "user2", "repo1", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser) 1029 + 1030 + dstPath := t.TempDir() 1031 + 1032 + u.Path = baseAPITestContext.GitPath() 1033 + u.User = url.UserPassword("user2", userPassword) 1034 + 1035 + t.Run("Clone", doGitClone(dstPath, u)) 1036 + 1037 + err := os.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content"), 0o666) 1038 + require.NoError(t, err) 1039 + 1040 + err = git.AddChanges(dstPath, true) 1041 + require.NoError(t, err) 1042 + 1043 + err = git.CommitChanges(dstPath, git.CommitChangesOptions{ 1044 + Committer: &git.Signature{ 1045 + Email: "user2@example.com", 1046 + Name: "user2", 1047 + When: time.Now(), 1048 + }, 1049 + Author: &git.Signature{ 1050 + Email: "user2@example.com", 1051 + Name: "user2", 1052 + When: time.Now(), 1053 + }, 1054 + Message: "Testing commit 1", 1055 + }) 1056 + require.NoError(t, err) 1057 + 1058 + stderrBuf := &bytes.Buffer{} 1059 + 1060 + err = git.NewCommand(git.DefaultContext, "push", "origin", "HEAD:refs/for/master", "-o"). 1061 + AddDynamicArguments(`topic=test/head2`). 1062 + AddArguments("-o"). 1063 + AddDynamicArguments(`title="create a test pull request with agit"`). 1064 + AddArguments("-o"). 1065 + AddDynamicArguments(`description="This PR is a test pull request which created with agit"`). 1066 + Run(&git.RunOpts{Dir: dstPath, Stderr: stderrBuf}) 1067 + require.NoError(t, err) 1068 + 1069 + assert.Contains(t, stderrBuf.String(), setting.AppURL+"user2/repo1/pulls/6") 1070 + 1071 + baseRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{OwnerName: "user2", Name: "repo1"}) 1072 + pr := unittest.AssertExistsAndLoadBean(t, &issues_model.PullRequest{ 1073 + Flow: issues_model.PullRequestFlowAGit, 1074 + BaseRepoID: baseRepo.ID, 1075 + BaseBranch: "master", 1076 + HeadRepoID: baseRepo.ID, 1077 + HeadBranch: "user2/test/head2", 1078 + }) 1079 + 1080 + session := loginUser(t, "user1") 1081 + // add protected branch for commit status 1082 + csrf := GetCSRF(t, session, "/user2/repo1/settings/branches") 1083 + // Change master branch to protected 1084 + req := NewRequestWithValues(t, "POST", "/user2/repo1/settings/branches/edit", map[string]string{ 1085 + "_csrf": csrf, 1086 + "rule_name": "master", 1087 + "enable_push": "true", 1088 + "enable_status_check": "true", 1089 + "status_check_contexts": "gitea/actions", 1090 + "required_approvals": "1", 1091 + }) 1092 + session.MakeRequest(t, req, http.StatusSeeOther) 1093 + 1094 + user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}) 1095 + // first time insert automerge record, return true 1096 + scheduled, err := automerge.ScheduleAutoMerge(db.DefaultContext, user1, pr, repo_model.MergeStyleMerge, "auto merge test") 1097 + require.NoError(t, err) 1098 + assert.True(t, scheduled) 1099 + 1100 + // second time insert automerge record, return false because it does exist 1101 + scheduled, err = automerge.ScheduleAutoMerge(db.DefaultContext, user1, pr, repo_model.MergeStyleMerge, "auto merge test") 1102 + require.Error(t, err) 1103 + assert.False(t, scheduled) 1104 + 1105 + // reload pr again 1106 + pr = unittest.AssertExistsAndLoadBean(t, &issues_model.PullRequest{ID: pr.ID}) 1107 + assert.False(t, pr.HasMerged) 1108 + assert.Empty(t, pr.MergedCommitID) 1109 + 1110 + // update commit status to success, then it should be merged automatically 1111 + baseGitRepo, err := gitrepo.OpenRepository(db.DefaultContext, baseRepo) 1112 + require.NoError(t, err) 1113 + sha, err := baseGitRepo.GetRefCommitID(pr.GetGitRefName()) 1114 + require.NoError(t, err) 1115 + masterCommitID, err := baseGitRepo.GetBranchCommitID("master") 1116 + require.NoError(t, err) 1117 + baseGitRepo.Close() 1118 + defer func() { 1119 + testResetRepo(t, baseRepo.RepoPath(), "master", masterCommitID) 1120 + }() 1121 + 1122 + err = commitstatus_service.CreateCommitStatus(db.DefaultContext, baseRepo, user1, sha, &git_model.CommitStatus{ 1123 + State: api.CommitStatusSuccess, 1124 + TargetURL: "https://gitea.com", 1125 + Context: "gitea/actions", 1126 + }) 1127 + require.NoError(t, err) 1128 + 1129 + time.Sleep(2 * time.Second) 1130 + 1131 + // reload pr again 1132 + pr = unittest.AssertExistsAndLoadBean(t, &issues_model.PullRequest{ID: pr.ID}) 1133 + assert.False(t, pr.HasMerged) 1134 + assert.Empty(t, pr.MergedCommitID) 1135 + 1136 + // approve the PR from non-author 1137 + approveSession := loginUser(t, "user1") 1138 + req = NewRequest(t, "GET", fmt.Sprintf("/user2/repo1/pulls/%d", pr.Index)) 1139 + resp := approveSession.MakeRequest(t, req, http.StatusOK) 1140 + htmlDoc := NewHTMLParser(t, resp.Body) 1141 + testSubmitReview(t, approveSession, htmlDoc.GetCSRF(), "user2", "repo1", strconv.Itoa(int(pr.Index)), sha, "approve", http.StatusOK) 1142 + 1143 + time.Sleep(2 * time.Second) 1144 + 1145 + // realod pr again 1146 + pr = unittest.AssertExistsAndLoadBean(t, &issues_model.PullRequest{ID: pr.ID}) 1147 + assert.True(t, pr.HasMerged) 1148 + assert.NotEmpty(t, pr.MergedCommitID) 1149 + 1150 + unittest.AssertNotExistsBean(t, &pull_model.AutoMerge{PullID: pr.ID}) 1151 + }) 1152 + }