Skip to content

Commit 7a893da

Browse files
eladynlunny6543
authored
ignore missing comment for user notifications (#18954)
* ignore missing comment for user notifications * instead fix bug in notifications model * use local variable instead Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: 6543 <[email protected]>
1 parent e800bc0 commit 7a893da

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

models/notification.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,14 +498,15 @@ func (n *Notification) APIURL() string {
498498
type NotificationList []*Notification
499499

500500
// LoadAttributes load Repo Issue User and Comment if not loaded
501-
func (nl NotificationList) LoadAttributes() (err error) {
501+
func (nl NotificationList) LoadAttributes() error {
502+
var err error
502503
for i := 0; i < len(nl); i++ {
503504
err = nl[i].LoadAttributes()
504505
if err != nil && !IsErrCommentNotExist(err) {
505-
return
506+
return err
506507
}
507508
}
508-
return
509+
return nil
509510
}
510511

511512
func (nl NotificationList) getPendingRepoIDs() []int64 {

routers/api/v1/notify/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func ListRepoNotifications(ctx *context.APIContext) {
121121
return
122122
}
123123
err = nl.LoadAttributes()
124-
if err != nil && !models.IsErrCommentNotExist(err) {
124+
if err != nil {
125125
ctx.InternalServerError(err)
126126
return
127127
}

0 commit comments

Comments
 (0)