Signed-off-by: oppiliappan me@oppi.li
+12
-32
Diff
round #1
+7
-17
appview/models/pull.go
+7
-17
appview/models/pull.go
···
171
171
return syntax.ATURI(p.CommentAt)
172
172
}
173
173
174
-
// func (p *PullComment) AsRecord() tangled.RepoPullComment {
175
-
// mentions := make([]string, len(p.Mentions))
176
-
// for i, did := range p.Mentions {
177
-
// mentions[i] = string(did)
178
-
// }
179
-
// references := make([]string, len(p.References))
180
-
// for i, uri := range p.References {
181
-
// references[i] = string(uri)
182
-
// }
183
-
// return tangled.RepoPullComment{
184
-
// Pull: p.PullAt,
185
-
// Body: p.Body,
186
-
// Mentions: mentions,
187
-
// References: references,
188
-
// CreatedAt: p.Created.Format(time.RFC3339),
189
-
// }
190
-
// }
174
+
func (p *Pull) TotalComments() int {
175
+
total := 0
176
+
for _, s := range p.Submissions {
177
+
total += len(s.Comments)
178
+
}
179
+
return total
180
+
}
191
181
192
182
func (p *Pull) LastRoundNumber() int {
193
183
return len(p.Submissions) - 1
+2
-3
appview/pages/templates/repo/pulls/fragments/summarizedPullHeader.html
+2
-3
appview/pages/templates/repo/pulls/fragments/summarizedPullHeader.html
···
15
15
16
16
<div class="flex-shrink-0 flex items-center gap-2">
17
17
{{ $latestRound := .LastRoundNumber }}
18
-
{{ $lastSubmission := index .Submissions $latestRound }}
19
-
{{ $commentCount := len $lastSubmission.Comments }}
18
+
{{ $commentCount := .TotalComments }}
20
19
{{ if and $pipeline $pipeline.Id }}
21
-
{{ template "repo/pipelines/fragments/pipelineSymbol" $pipeline }}
20
+
{{ template "repo/pipelines/fragments/pipelineSymbol" (dict "Pipeline" $pipeline "ShortSummary" true) }}
22
21
<span class="before:content-['路'] before:select-none text-gray-500 dark:text-gray-400"></span>
23
22
{{ end }}
24
23
<span>
+3
-12
appview/pages/templates/repo/pulls/pulls.html
+3
-12
appview/pages/templates/repo/pulls/pulls.html
···
112
112
{{ template "repo/fragments/time" .Created }}
113
113
</span>
114
114
115
-
116
-
{{ $latestRound := .LastRoundNumber }}
117
-
{{ $lastSubmission := index .Submissions $latestRound }}
118
-
119
115
<span class="before:content-['路']">
120
-
{{ $commentCount := len $lastSubmission.Comments }}
121
-
{{ $s := "s" }}
122
-
{{ if eq $commentCount 1 }}
123
-
{{ $s = "" }}
124
-
{{ end }}
125
-
126
-
{{ len $lastSubmission.Comments}} comment{{$s}}
116
+
{{ $commentCount := .TotalComments }}
117
+
{{ $commentCount }} comment{{ if ne $commentCount 1 }}s{{ end }}
127
118
</span>
128
119
129
120
<span class="before:content-['路']">
···
136
127
{{ $pipeline := index $.Pipelines .LatestSha }}
137
128
{{ if and $pipeline $pipeline.Id }}
138
129
<span class="before:content-['路']"></span>
139
-
{{ template "repo/pipelines/fragments/pipelineSymbol" $pipeline }}
130
+
{{ template "repo/pipelines/fragments/pipelineSymbol" (dict "Pipeline" $pipeline "ShortSummary" true) }}
140
131
{{ end }}
141
132
142
133
{{ $state := .Labels }}
History
2 rounds
0 comments
1 commit
expand
collapse
appview/models: add helper func to count total comments on a PR
Signed-off-by: oppiliappan <me@oppi.li>
3/3 success
expand
collapse
expand 0 comments
pull request successfully merged
1 commit
expand
collapse
appview/models: add helper func to count total comments on a PR
Signed-off-by: oppiliappan <me@oppi.li>