Skip to content

Commit f3d3d49

Browse files
committed
Fix reorder
1 parent 43921af commit f3d3d49

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

models/notification.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,21 @@ func updateIssueNotification(e Engine, userID, issueID, commentID, updatedByID i
190190
return err
191191
}
192192

193-
// NOTICE: Only update when the before notification on this issue is read, otherwise you may miss some notifications
193+
// NOTICE: Only update comment id when the before notification on this issue is read, otherwise you may miss some old comments.
194+
// But we need update update_by so that the notification will be reorder
195+
var cols []string
194196
if notification.Status == NotificationStatusRead {
195197
notification.Status = NotificationStatusUnread
196-
notification.UpdatedBy = updatedByID
197198
notification.CommentID = commentID
198-
_, err = e.ID(notification.ID).Cols("status, update_by, comment_id").Update(notification)
199-
return err
199+
cols = []string{"status", "update_by", "comment_id"}
200+
} else {
201+
notification.UpdatedBy = updatedByID
202+
cols = []string{"update_by"}
200203
}
201204

205+
_, err = e.ID(notification.ID).Cols(cols...).Update(notification)
206+
return err
207+
202208
return nil
203209
}
204210

0 commit comments

Comments
 (0)