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