File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -228,13 +228,19 @@ func (a *Action) GetCommentHTMLURL() string {
228
228
return a .getCommentHTMLURL (db .DefaultContext )
229
229
}
230
230
231
+ func (a * Action ) loadComment (ctx context.Context ) (err error ) {
232
+ if a .CommentID == 0 || a .Comment != nil {
233
+ return nil
234
+ }
235
+ a .Comment , err = issues_model .GetCommentByID (ctx , a .CommentID )
236
+ return
237
+ }
238
+
231
239
func (a * Action ) getCommentHTMLURL (ctx context.Context ) string {
232
240
if a == nil {
233
241
return "#"
234
242
}
235
- if a .Comment == nil && a .CommentID != 0 {
236
- a .Comment , _ = issues_model .GetCommentByID (ctx , a .CommentID )
237
- }
243
+ _ = a .loadComment (ctx )
238
244
if a .Comment != nil {
239
245
return a .Comment .HTMLURL ()
240
246
}
@@ -269,9 +275,7 @@ func (a *Action) getCommentLink(ctx context.Context) string {
269
275
if a == nil {
270
276
return "#"
271
277
}
272
- if a .Comment == nil && a .CommentID != 0 {
273
- a .Comment , _ = issues_model .GetCommentByID (ctx , a .CommentID )
274
- }
278
+ _ = a .loadComment (ctx )
275
279
if a .Comment != nil {
276
280
return a .Comment .Link ()
277
281
}
You can’t perform that action at this time.
0 commit comments