Skip to content

Commit

Permalink
ignore missing comment for user notifications (#18954)
Browse files Browse the repository at this point in the history
* ignore missing comment for user notifications

* instead fix bug in notifications model

* use local variable instead

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
  • Loading branch information
3 people authored Mar 3, 2022
1 parent e800bc0 commit 7a893da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions models/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,14 +498,15 @@ func (n *Notification) APIURL() string {
type NotificationList []*Notification

// LoadAttributes load Repo Issue User and Comment if not loaded
func (nl NotificationList) LoadAttributes() (err error) {
func (nl NotificationList) LoadAttributes() error {
var err error
for i := 0; i < len(nl); i++ {
err = nl[i].LoadAttributes()
if err != nil && !IsErrCommentNotExist(err) {
return
return err
}
}
return
return nil
}

func (nl NotificationList) getPendingRepoIDs() []int64 {
Expand Down
2 changes: 1 addition & 1 deletion routers/api/v1/notify/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func ListRepoNotifications(ctx *context.APIContext) {
return
}
err = nl.LoadAttributes()
if err != nil && !models.IsErrCommentNotExist(err) {
if err != nil {
ctx.InternalServerError(err)
return
}
Expand Down

0 comments on commit 7a893da

Please sign in to comment.