mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	Show Pull Request button or status of latest PR in branch list (#6990)
* Show Pull Request button or status of latest PR in branch list Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Do not show pull request button on deleted branches Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Do not show commit divergence on deleted branches Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Use XORMs Get instead of limit * Links pull request ID and use smaller labels for displaying the pull request status Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Handle error when getting latest pull request Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Indent template Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Check error when loading issue Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
This commit is contained in:
		
				
					committed by
					
						 Lunny Xiao
						Lunny Xiao
					
				
			
			
				
	
			
			
			
						parent
						
							c37ec66ee2
						
					
				
				
					commit
					7c0f2b9843
				
			| @@ -776,6 +776,20 @@ func GetUnmergedPullRequestsByHeadInfo(repoID int64, branch string) ([]*PullRequ | ||||
| 		Find(&prs) | ||||
| } | ||||
|  | ||||
| // GetLatestPullRequestByHeadInfo returns the latest pull request (regardless of its status) | ||||
| // by given head information (repo and branch). | ||||
| func GetLatestPullRequestByHeadInfo(repoID int64, branch string) (*PullRequest, error) { | ||||
| 	pr := new(PullRequest) | ||||
| 	has, err := x. | ||||
| 		Where("head_repo_id = ? AND head_branch = ?", repoID, branch). | ||||
| 		OrderBy("id DESC"). | ||||
| 		Get(pr) | ||||
| 	if !has { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return pr, err | ||||
| } | ||||
|  | ||||
| // GetUnmergedPullRequestsByBaseInfo returns all pull requests that are open and has not been merged | ||||
| // by given base information (repo and branch). | ||||
| func GetUnmergedPullRequestsByBaseInfo(repoID int64, branch string) ([]*PullRequest, error) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user