mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Fix 500 when a comment was deleted which has a notification (#17550)
* Fix 500 when a comment was deleted which has a notification * Tolerate missing Comment in other places too Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -121,7 +121,7 @@ func ListRepoNotifications(ctx *context.APIContext) {
|
||||
return
|
||||
}
|
||||
err = nl.LoadAttributes()
|
||||
if err != nil {
|
||||
if err != nil && !models.IsErrCommentNotExist(err) {
|
||||
ctx.InternalServerError(err)
|
||||
return
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ func GetThread(ctx *context.APIContext) {
|
||||
if n == nil {
|
||||
return
|
||||
}
|
||||
if err := n.LoadAttributes(); err != nil {
|
||||
if err := n.LoadAttributes(); err != nil && !models.IsErrCommentNotExist(err) {
|
||||
ctx.InternalServerError(err)
|
||||
return
|
||||
}
|
||||
@@ -92,7 +92,7 @@ func ReadThread(ctx *context.APIContext) {
|
||||
ctx.InternalServerError(err)
|
||||
return
|
||||
}
|
||||
if err = notif.LoadAttributes(); err != nil {
|
||||
if err = notif.LoadAttributes(); err != nil && !models.IsErrCommentNotExist(err) {
|
||||
ctx.InternalServerError(err)
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user