mirror of
1
Fork 0

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 <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
eladyn 2022-03-03 16:18:26 +01:00 committed by GitHub
parent e800bc0cf4
commit 7a893dab39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -498,14 +498,15 @@ func (n *Notification) APIURL() string {
type NotificationList []*Notification type NotificationList []*Notification
// LoadAttributes load Repo Issue User and Comment if not loaded // 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++ { for i := 0; i < len(nl); i++ {
err = nl[i].LoadAttributes() err = nl[i].LoadAttributes()
if err != nil && !IsErrCommentNotExist(err) { if err != nil && !IsErrCommentNotExist(err) {
return return err
} }
} }
return return nil
} }
func (nl NotificationList) getPendingRepoIDs() []int64 { func (nl NotificationList) getPendingRepoIDs() []int64 {

View File

@ -121,7 +121,7 @@ func ListRepoNotifications(ctx *context.APIContext) {
return return
} }
err = nl.LoadAttributes() err = nl.LoadAttributes()
if err != nil && !models.IsErrCommentNotExist(err) { if err != nil {
ctx.InternalServerError(err) ctx.InternalServerError(err)
return return
} }