@@ -5,7 +5,6 @@ package issues
55
66import  (
77	"context" 
8- 	"strconv" 
98
109	"code.gitea.io/gitea/models/db" 
1110	git_model "code.gitea.io/gitea/models/git" 
@@ -25,7 +24,7 @@ type IssueDevLink struct {
2524	IssueID        int64  `xorm:"INDEX"` 
2625	LinkType       IssueDevLinkType 
2726	LinkedRepoID   int64                   `xorm:"INDEX"`  // it can link to self repo or other repo 
28- 	LinkID         int64                   // branch id in branch table or pull request id 
27+ 	LinkID         int64                   // branch id in branch table or the  pull request id(not issue if of the pull request)  
2928	CreatedUnix    timeutil.TimeStamp      `xorm:"INDEX created"` 
3029	Repo           * repo_model.Repository  `xorm:"-"`  // current repo of issue 
3130	LinkedRepo     * repo_model.Repository  `xorm:"-"` 
@@ -54,32 +53,7 @@ func FindIssueDevLinksByIssueID(ctx context.Context, issueID int64) (IssueDevLin
5453	return  links , db .GetEngine (ctx ).Where ("issue_id = ?" , issueID ).Find (& links )
5554}
5655
57- func  FindDevLinksByBranch (ctx  context.Context , repoID , linkedRepoID  int64 , branchName  string ) (IssueDevLinks , error ) {
58- 	links  :=  make (IssueDevLinks , 0 , 5 )
59- 	return  links , db .GetEngine (ctx ).
60- 		Join ("INNER" , "issue" , "issue_dev_link.issue_id = issue.id" ).
61- 		Where ("link_type = ? AND link_index = ? AND linked_repo_id = ?" ,
62- 			IssueDevLinkTypeBranch , branchName , linkedRepoID ).
63- 		And ("issue.repo_id=?" , repoID ).
64- 		Find (& links )
65- }
66- 
6756func  CreateIssueDevLink (ctx  context.Context , link  * IssueDevLink ) error  {
6857	_ , err  :=  db .GetEngine (ctx ).Insert (link )
6958	return  err 
7059}
71- 
72- func  DeleteIssueDevLinkByBranchName (ctx  context.Context , repoID  int64 , branchName  string ) error  {
73- 	_ , err  :=  db .GetEngine (ctx ).
74- 		Where ("linked_repo_id = ? AND link_type = ? AND link_index = ?" ,
75- 			repoID , IssueDevLinkTypeBranch , branchName ).
76- 		Delete (new (IssueDevLink ))
77- 	return  err 
78- }
79- 
80- func  DeleteIssueDevLinkByPullRequestID (ctx  context.Context , pullID  int64 ) error  {
81- 	pullIDStr  :=  strconv .FormatInt (pullID , 10 )
82- 	_ , err  :=  db .GetEngine (ctx ).Where ("link_type = ? AND link_index = ?" , IssueDevLinkTypePullRequest , pullIDStr ).
83- 		Delete (new (IssueDevLink ))
84- 	return  err 
85- }
0 commit comments