mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Use for a repo action one database transaction (#19576)
... more context (part of #9307)
This commit is contained in:
		@@ -1295,7 +1295,7 @@ func ViewIssue(ctx *context.Context) {
 | 
			
		||||
 | 
			
		||||
	if ctx.IsSigned {
 | 
			
		||||
		// Update issue-user.
 | 
			
		||||
		if err = issue.ReadBy(ctx.Doer.ID); err != nil {
 | 
			
		||||
		if err = issue.ReadBy(ctx, ctx.Doer.ID); err != nil {
 | 
			
		||||
			ctx.ServerError("ReadBy", err)
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
@@ -1557,7 +1557,7 @@ func ViewIssue(ctx *context.Context) {
 | 
			
		||||
				ctx.ServerError("GetUserRepoPermission", err)
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
			ctx.Data["AllowMerge"], err = pull_service.IsUserAllowedToMerge(pull, perm, ctx.Doer)
 | 
			
		||||
			ctx.Data["AllowMerge"], err = pull_service.IsUserAllowedToMerge(ctx, pull, perm, ctx.Doer)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				ctx.ServerError("IsUserAllowedToMerge", err)
 | 
			
		||||
				return
 | 
			
		||||
@@ -1606,12 +1606,11 @@ func ViewIssue(ctx *context.Context) {
 | 
			
		||||
			if ctx.Doer != nil {
 | 
			
		||||
				showMergeInstructions = pull.ProtectedBranch.CanUserPush(ctx.Doer.ID)
 | 
			
		||||
			}
 | 
			
		||||
			cnt := pull.ProtectedBranch.GetGrantedApprovalsCount(pull)
 | 
			
		||||
			ctx.Data["IsBlockedByApprovals"] = !pull.ProtectedBranch.HasEnoughApprovals(pull)
 | 
			
		||||
			ctx.Data["IsBlockedByRejection"] = pull.ProtectedBranch.MergeBlockedByRejectedReview(pull)
 | 
			
		||||
			ctx.Data["IsBlockedByOfficialReviewRequests"] = pull.ProtectedBranch.MergeBlockedByOfficialReviewRequests(pull)
 | 
			
		||||
			ctx.Data["IsBlockedByApprovals"] = !pull.ProtectedBranch.HasEnoughApprovals(ctx, pull)
 | 
			
		||||
			ctx.Data["IsBlockedByRejection"] = pull.ProtectedBranch.MergeBlockedByRejectedReview(ctx, pull)
 | 
			
		||||
			ctx.Data["IsBlockedByOfficialReviewRequests"] = pull.ProtectedBranch.MergeBlockedByOfficialReviewRequests(ctx, pull)
 | 
			
		||||
			ctx.Data["IsBlockedByOutdatedBranch"] = pull.ProtectedBranch.MergeBlockedByOutdatedBranch(pull)
 | 
			
		||||
			ctx.Data["GrantedApprovals"] = cnt
 | 
			
		||||
			ctx.Data["GrantedApprovals"] = pull.ProtectedBranch.GetGrantedApprovalsCount(ctx, pull)
 | 
			
		||||
			ctx.Data["RequireSigned"] = pull.ProtectedBranch.RequireSignedCommits
 | 
			
		||||
			ctx.Data["ChangedProtectedFiles"] = pull.ChangedProtectedFiles
 | 
			
		||||
			ctx.Data["IsBlockedByChangedProtectedFiles"] = len(pull.ChangedProtectedFiles) != 0
 | 
			
		||||
@@ -1641,7 +1640,7 @@ func ViewIssue(ctx *context.Context) {
 | 
			
		||||
			(!pull.HasMerged || ctx.Data["HeadBranchCommitID"] == ctx.Data["PullHeadCommitID"])
 | 
			
		||||
 | 
			
		||||
		if isPullBranchDeletable && pull.HasMerged {
 | 
			
		||||
			exist, err := models.HasUnmergedPullRequestsByHeadInfo(pull.HeadRepoID, pull.HeadBranch)
 | 
			
		||||
			exist, err := models.HasUnmergedPullRequestsByHeadInfo(ctx, pull.HeadRepoID, pull.HeadBranch)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				ctx.ServerError("HasUnmergedPullRequestsByHeadInfo", err)
 | 
			
		||||
				return
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user