]> source.dussan.org Git - gitea.git/commitdiff
ignore missing comment for user notifications (#18954)
authoreladyn <59307989+eladyn@users.noreply.github.com>
Thu, 3 Mar 2022 15:18:26 +0000 (16:18 +0100)
committerGitHub <noreply@github.com>
Thu, 3 Mar 2022 15:18:26 +0000 (16:18 +0100)
* 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>
models/notification.go
routers/api/v1/notify/repo.go

index 8f5d9d01e6e32fdd9d043c6b16f877d9927fcba6..b53d236e433f9ef5546e04caa7725a34b993ddcd 100644 (file)
@@ -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 {
index 8bf5d37116f925358e1e75608031d7d222e8b6e6..30357ebd3f88d43eac8aacdc0f4ea1a0c1eac6db 100644 (file)
@@ -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
        }