@@ -310,7 +310,7 @@ func createIssueNotification(ctx context.Context, userID int64, issue *issues_mo
310
310
}
311
311
312
312
func updateIssueNotification (ctx context.Context , userID , issueID , commentID , updatedByID int64 ) error {
313
- notification , err := getIssueNotification (ctx , userID , issueID )
313
+ notification , err := GetIssueNotification (ctx , userID , issueID )
314
314
if err != nil {
315
315
return err
316
316
}
@@ -331,7 +331,8 @@ func updateIssueNotification(ctx context.Context, userID, issueID, commentID, up
331
331
return err
332
332
}
333
333
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 ) {
335
336
notification := new (Notification )
336
337
_ , err := db .GetEngine (ctx ).
337
338
Where ("user_id = ?" , userID ).
@@ -742,15 +743,15 @@ func GetUIDsAndNotificationCounts(since, until timeutil.TimeStamp) ([]UserIDCoun
742
743
743
744
// SetIssueReadBy sets issue to be read by given user.
744
745
func 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 {
746
747
return err
747
748
}
748
749
749
750
return setIssueNotificationStatusReadIfUnread (ctx , userID , issueID )
750
751
}
751
752
752
753
func setIssueNotificationStatusReadIfUnread (ctx context.Context , userID , issueID int64 ) error {
753
- notification , err := getIssueNotification (ctx , userID , issueID )
754
+ notification , err := GetIssueNotification (ctx , userID , issueID )
754
755
// ignore if not exists
755
756
if err != nil {
756
757
return nil
@@ -762,7 +763,7 @@ func setIssueNotificationStatusReadIfUnread(ctx context.Context, userID, issueID
762
763
763
764
notification .Status = NotificationStatusRead
764
765
765
- _ , err = db .GetEngine (ctx ).ID (notification .ID ).Update (notification )
766
+ _ , err = db .GetEngine (ctx ).ID (notification .ID ).Cols ( "status" ). Update (notification )
766
767
return err
767
768
}
768
769
0 commit comments