1
1
mirror of https://github.com/go-gitea/gitea synced 2025-11-08 23:38:13 +00:00

Add a new section named development in issue view sidebar to interact with branch/pr

This commit is contained in:
Lunny Xiao
2024-08-21 15:34:03 -07:00
parent 40036b6102
commit 62fda252bd
14 changed files with 415 additions and 52 deletions

View File

@@ -10,6 +10,7 @@ import (
"io"
"os"
"regexp"
"strconv"
"strings"
"time"
@@ -166,6 +167,24 @@ func NewPullRequest(ctx context.Context, repo *repo_model.Repository, issue *iss
return err
}
}
if pr.Flow == issues_model.PullRequestFlowGithub {
devLinks, err := issues_model.FindDevLinksByBranch(ctx, issue.RepoID, pr.HeadRepoID, pr.HeadBranch)
if err != nil {
return err
}
for _, link := range devLinks {
if err := issues_model.CreateIssueDevLink(ctx, &issues_model.IssueDevLink{
IssueID: link.IssueID,
LinkType: issues_model.IssueDevLinkTypePullRequest,
LinkedRepoID: pr.HeadRepoID,
LinkIndex: strconv.FormatInt(pr.ID, 10),
}); err != nil {
return err
}
}
}
return nil
}); err != nil {
// cleanup: this will only remove the reference, the real commit will be clean up when next GC