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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user