@@ -310,7 +310,7 @@ func createIssueNotification(ctx context.Context, userID int64, issue *issues_mo
310310}
311311
312312func updateIssueNotification (ctx context.Context , userID , issueID , commentID , updatedByID int64 ) error {
313- notification , err := getIssueNotification (ctx , userID , issueID )
313+ notification , err := GetIssueNotification (ctx , userID , issueID )
314314 if err != nil {
315315 return err
316316 }
@@ -331,7 +331,8 @@ func updateIssueNotification(ctx context.Context, userID, issueID, commentID, up
331331 return err
332332}
333333
334- func getIssueNotification (ctx context.Context , userID , issueID int64 ) (* Notification , error ) {
334+ // GetIssueNotification return the notification about an issue
335+ func GetIssueNotification (ctx context.Context , userID , issueID int64 ) (* Notification , error ) {
335336 notification := new (Notification )
336337 _ , err := db .GetEngine (ctx ).
337338 Where ("user_id = ?" , userID ).
@@ -742,15 +743,15 @@ func GetUIDsAndNotificationCounts(since, until timeutil.TimeStamp) ([]UserIDCoun
742743
743744// SetIssueReadBy sets issue to be read by given user.
744745func SetIssueReadBy (ctx context.Context , issueID , userID int64 ) error {
745- if err := issues_model .UpdateIssueUserByRead (userID , issueID ); err != nil {
746+ if err := issues_model .UpdateIssueUserByRead (ctx , userID , issueID ); err != nil {
746747 return err
747748 }
748749
749750 return setIssueNotificationStatusReadIfUnread (ctx , userID , issueID )
750751}
751752
752753func setIssueNotificationStatusReadIfUnread (ctx context.Context , userID , issueID int64 ) error {
753- notification , err := getIssueNotification (ctx , userID , issueID )
754+ notification , err := GetIssueNotification (ctx , userID , issueID )
754755 // ignore if not exists
755756 if err != nil {
756757 return nil
@@ -762,7 +763,7 @@ func setIssueNotificationStatusReadIfUnread(ctx context.Context, userID, issueID
762763
763764 notification .Status = NotificationStatusRead
764765
765- _ , err = db .GetEngine (ctx ).ID (notification .ID ).Update (notification )
766+ _ , err = db .GetEngine (ctx ).ID (notification .ID ).Cols ( "status" ). Update (notification )
766767 return err
767768}
768769
0 commit comments