|
|
@ -310,7 +310,7 @@ func createIssueNotification(ctx context.Context, userID int64, issue *issues_mo |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func updateIssueNotification(ctx context.Context, userID, issueID, commentID, updatedByID int64) error { |
|
|
|
func updateIssueNotification(ctx context.Context, userID, issueID, commentID, updatedByID int64) error { |
|
|
|
notification, err := getIssueNotification(ctx, userID, issueID) |
|
|
|
notification, err := GetIssueNotification(ctx, userID, issueID) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
@ -331,7 +331,8 @@ func updateIssueNotification(ctx context.Context, userID, issueID, commentID, up |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func getIssueNotification(ctx context.Context, userID, issueID int64) (*Notification, error) { |
|
|
|
// GetIssueNotification return the notification about an issue
|
|
|
|
|
|
|
|
func GetIssueNotification(ctx context.Context, userID, issueID int64) (*Notification, error) { |
|
|
|
notification := new(Notification) |
|
|
|
notification := new(Notification) |
|
|
|
_, err := db.GetEngine(ctx). |
|
|
|
_, err := db.GetEngine(ctx). |
|
|
|
Where("user_id = ?", userID). |
|
|
|
Where("user_id = ?", userID). |
|
|
@ -742,7 +743,7 @@ func GetUIDsAndNotificationCounts(since, until timeutil.TimeStamp) ([]UserIDCoun |
|
|
|
|
|
|
|
|
|
|
|
// SetIssueReadBy sets issue to be read by given user.
|
|
|
|
// SetIssueReadBy sets issue to be read by given user.
|
|
|
|
func SetIssueReadBy(ctx context.Context, issueID, userID int64) error { |
|
|
|
func SetIssueReadBy(ctx context.Context, issueID, userID int64) error { |
|
|
|
if err := issues_model.UpdateIssueUserByRead(userID, issueID); err != nil { |
|
|
|
if err := issues_model.UpdateIssueUserByRead(ctx, userID, issueID); err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -750,7 +751,7 @@ func SetIssueReadBy(ctx context.Context, issueID, userID int64) error { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func setIssueNotificationStatusReadIfUnread(ctx context.Context, userID, issueID int64) error { |
|
|
|
func setIssueNotificationStatusReadIfUnread(ctx context.Context, userID, issueID int64) error { |
|
|
|
notification, err := getIssueNotification(ctx, userID, issueID) |
|
|
|
notification, err := GetIssueNotification(ctx, userID, issueID) |
|
|
|
// ignore if not exists
|
|
|
|
// ignore if not exists
|
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil |
|
|
|
return nil |
|
|
@ -762,7 +763,7 @@ func setIssueNotificationStatusReadIfUnread(ctx context.Context, userID, issueID |
|
|
|
|
|
|
|
|
|
|
|
notification.Status = NotificationStatusRead |
|
|
|
notification.Status = NotificationStatusRead |
|
|
|
|
|
|
|
|
|
|
|
_, err = db.GetEngine(ctx).ID(notification.ID).Update(notification) |
|
|
|
_, err = db.GetEngine(ctx).ID(notification.ID).Cols("status").Update(notification) |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|