mirror of
https://github.com/go-gitea/gitea
synced 2025-02-08 19:57:01 +01:00
Display forked repository's branch
This commit is contained in:
parent
703eebfa92
commit
ab6d2ed9d7
@ -21,13 +21,13 @@ const (
|
||||
)
|
||||
|
||||
type IssueDevLink struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
IssueID int64 `xorm:"INDEX"`
|
||||
LinkType IssueDevLinkType
|
||||
LinkedRepoID int64 `xorm:"INDEX"` // it can link to self repo or other repo
|
||||
LinkIndex string // branch name, pull request number or commit sha
|
||||
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
|
||||
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
IssueID int64 `xorm:"INDEX"`
|
||||
LinkType IssueDevLinkType
|
||||
LinkedRepoID int64 `xorm:"INDEX"` // it can link to self repo or other repo
|
||||
LinkIndex string // branch name, pull request number or commit sha
|
||||
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
|
||||
Repo *repo_model.Repository `xorm:"-"` // current repo of issue
|
||||
LinkedRepo *repo_model.Repository `xorm:"-"`
|
||||
PullRequest *PullRequest `xorm:"-"`
|
||||
Branch *git_model.Branch `xorm:"-"`
|
||||
@ -38,6 +38,13 @@ func init() {
|
||||
db.RegisterModel(new(IssueDevLink))
|
||||
}
|
||||
|
||||
func (i *IssueDevLink) BranchFullName() string {
|
||||
if i.Repo.ID == i.LinkedRepo.ID {
|
||||
return i.Branch.Name
|
||||
}
|
||||
return i.LinkedRepo.FullName() + ":" + i.Branch.Name
|
||||
}
|
||||
|
||||
// IssueDevLinks represents a list of issue development links
|
||||
type IssueDevLinks []*IssueDevLink
|
||||
|
||||
|
@ -37,6 +37,7 @@ func FindIssueDevLinksByIssue(ctx context.Context, issue *issues_model.Issue) (i
|
||||
branchPRExists := make(container.Set[string])
|
||||
|
||||
for _, link := range devLinks {
|
||||
link.Repo = issue.Repo
|
||||
if link.LinkedRepoID == 0 {
|
||||
link.LinkedRepoID = issue.RepoID
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
{{range .DevLinks}}
|
||||
{{if .PullRequest}}
|
||||
<div class="tw-flex tw-items-center tw-overflow-hidden tw-max-w-full">
|
||||
{{template "shared/issueicon" .PullRequest.Issue}}
|
||||
<span class="tw-mr-1">{{template "shared/issueicon" .PullRequest.Issue}}</span>
|
||||
<a href="{{.PullRequest.Issue.Link}}" data-tooltip-content="{{.PullRequest.Issue.Title}}" class="item tw-overflow-hidden gt-ellipsis tw-whitespace-nowrap">
|
||||
{{.PullRequest.Issue.Title}}
|
||||
</a>
|
||||
@ -22,7 +22,7 @@
|
||||
{{ctx.Locale.Tr "repo.issues.pr.completed"}}
|
||||
</div>
|
||||
<div class="tw-flex tw-items-center tw-overflow-hidden tw-max-w-full">
|
||||
{{svg "octicon-git-commit" 14}} <a href="{{.PullRequest.BaseRepo.Link}}/src/commit/{{.PullRequest.MergedCommitID}}" data-tooltip-content="{{.PullRequest.MergedCommitID}}" class="tw-overflow-hidden gt-ellipsis tw-whitespace-nowrap">{{.PullRequest.MergedCommitID | ShortSha}}</a>
|
||||
{{svg "octicon-git-commit" 14 "tw-mr-1"}} <a href="{{.PullRequest.BaseRepo.Link}}/src/commit/{{.PullRequest.MergedCommitID}}" data-tooltip-content="{{.PullRequest.MergedCommitID}}" class="tw-overflow-hidden gt-ellipsis tw-whitespace-nowrap">{{.PullRequest.MergedCommitID | ShortSha}}</a>
|
||||
</div>
|
||||
<div>
|
||||
{{ctx.Locale.Tr "repo.issues.link.created" (DateUtils.AbsoluteShort .PullRequest.MergedUnix)}}
|
||||
@ -33,9 +33,9 @@
|
||||
{{else if and .Branch .DisplayBranch}}
|
||||
<div class="tw-flex tw-justify-between tw-items-center">
|
||||
<div class="tw-flex tw-left tw-items-center tw-overflow-hidden tw-max-w-full">
|
||||
{{svg "octicon-git-branch" 14}}
|
||||
<a href="{{.Branch.Repo.Link}}/src/branch/{{.Branch.Name}}" data-tooltip-content="{{.Branch.Name}}" class="tw-overflow-hidden gt-ellipsis tw-whitespace-nowrap">
|
||||
{{.Branch.Name}}
|
||||
{{svg "octicon-git-branch" 14 "tw-mr-1"}}
|
||||
<a href="{{.Branch.Repo.Link}}/src/branch/{{.Branch.Name}}" data-tooltip-content="{{.BranchFullName}}" class="tw-overflow-hidden gt-ellipsis tw-whitespace-nowrap">
|
||||
{{.BranchFullName}}
|
||||
</a>
|
||||
</div>
|
||||
<div class="tw-right tw-items-center">
|
||||
|
Loading…
x
Reference in New Issue
Block a user