File tree 3 files changed +47
-5
lines changed
3 files changed +47
-5
lines changed Original file line number Diff line number Diff line change @@ -25,15 +25,16 @@ const (
25
25
defaultMaxInSize = 50
26
26
)
27
27
28
+ // get the repo IDs to be loaded later, these IDs are for issue.Repo and issue.PullRequest.HeadRepo
28
29
func (issues IssueList ) getRepoIDs () []int64 {
29
30
repoIDs := make (map [int64 ]struct {}, len (issues ))
30
31
for _ , issue := range issues {
31
- if issue .Repo != nil {
32
- continue
33
- }
34
- if _ , ok := repoIDs [issue .RepoID ]; ! ok {
32
+ if issue .Repo == nil {
35
33
repoIDs [issue .RepoID ] = struct {}{}
36
34
}
35
+ if issue .PullRequest != nil && issue .PullRequest .HeadRepo == nil {
36
+ repoIDs [issue .PullRequest .HeadRepoID ] = struct {}{}
37
+ }
37
38
}
38
39
return container .KeysInt64 (repoIDs )
39
40
}
@@ -67,8 +68,11 @@ func (issues IssueList) loadRepositories(ctx context.Context) ([]*repo_model.Rep
67
68
} else {
68
69
repoMaps [issue .RepoID ] = issue .Repo
69
70
}
70
- if issue .PullRequest != nil && issue . PullRequest . BaseRepo == nil {
71
+ if issue .PullRequest != nil {
71
72
issue .PullRequest .BaseRepo = issue .Repo
73
+ if issue .PullRequest .HeadRepo == nil {
74
+ issue .PullRequest .HeadRepo = repoMaps [issue .PullRequest .HeadRepoID ]
75
+ }
72
76
}
73
77
}
74
78
return valuesRepository (repoMaps ), nil
Original file line number Diff line number Diff line change 59
59
{{else}}
60
60
{{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}}
61
61
{{end}}
62
+ {{if .IsPull}}
63
+ <div class="branches">
64
+ <div class="branch">
65
+ <a class="bold" href="{{.PullRequest.BaseRepo.HTMLURL}}/src/branch/{{PathEscapeSegments .PullRequest.BaseBranch}}">
66
+ {{/* inline to remove the spaces between spans */}}
67
+ {{if ne .RepoID .PullRequest.BaseRepoID}}<span class="truncated-name">{{.PullRequest.BaseRepo.OwnerName}}</span>:{{end}}<span class="truncated-name">{{.PullRequest.BaseBranch}}</span>
68
+ </a>
69
+ </div>
70
+
71
+ «
72
+
73
+ {{if .PullRequest.HeadRepo}}
74
+ <div class="branch">
75
+ <a class="bold" href="{{.PullRequest.HeadRepo.HTMLURL}}/src/branch/{{PathEscapeSegments .PullRequest.HeadBranch}}">
76
+ {{/* inline to remove the spaces between spans */}}
77
+ {{if ne .RepoID .PullRequest.HeadRepoID}}<span class="truncated-name">{{.PullRequest.HeadRepo.OwnerName}}</span>:{{end}}<span class="truncated-name">{{.PullRequest.HeadBranch}}</span>
78
+ </a>
79
+ </div>
80
+ {{end}}
81
+ </div>
82
+ {{end}}
62
83
{{if and .Milestone (ne $.listType "milestone")}}
63
84
<a class="milestone" {{if $.RepoLink}}href="{{$.RepoLink}}/milestone/{{.Milestone.ID}}"{{else}}href="{{.Repo.Link}}/milestone/{{.Milestone.ID}}"{{end}}>
64
85
{{svg "octicon-milestone" 14 "mr-2"}}{{.Milestone.Name}}
Original file line number Diff line number Diff line change 119
119
}
120
120
}
121
121
122
+ .branches {
123
+ display : inline-flex ;
124
+ padding : 0 6px ;
125
+
126
+ .branch {
127
+ background-color : var (--color-secondary );
128
+ border-radius : 3px ;
129
+ }
130
+
131
+ .truncated-name {
132
+ white-space : nowrap ;
133
+ overflow : hidden ;
134
+ text-overflow : ellipsis ;
135
+ max-width : 10em ;
136
+ }
137
+ }
138
+
122
139
> .item + .item {
123
140
border-top : 1px solid var (--color-secondary );
124
141
}
You can’t perform that action at this time.
0 commit comments