diff options
author | Norwin <noerw@users.noreply.github.com> | 2021-09-18 01:40:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-17 19:40:50 -0400 |
commit | 0ffad31b9285044fc8a2b424a1fe65522cc287d6 (patch) | |
tree | b4d183480410296505ddcae1da722b6728bdc0a3 /models/notification.go | |
parent | ba2e600d17bab8870f4ab33eb5816dff19a060c3 (diff) | |
download | gitea-0ffad31b9285044fc8a2b424a1fe65522cc287d6.tar.gz gitea-0ffad31b9285044fc8a2b424a1fe65522cc287d6.zip |
Notifications API: respond with updated notifications (#17064)
* notifications api: return updated notifications in response
* make generate-swagger
* openapi fix
Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'models/notification.go')
-rw-r--r-- | models/notification.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/models/notification.go b/models/notification.go index 5a35c4d732..fcd0c57dbd 100644 --- a/models/notification.go +++ b/models/notification.go @@ -772,20 +772,20 @@ func setRepoNotificationStatusReadIfUnread(e Engine, userID, repoID int64) error } // SetNotificationStatus change the notification status -func SetNotificationStatus(notificationID int64, user *User, status NotificationStatus) error { +func SetNotificationStatus(notificationID int64, user *User, status NotificationStatus) (*Notification, error) { notification, err := getNotificationByID(x, notificationID) if err != nil { - return err + return notification, err } if notification.UserID != user.ID { - return fmt.Errorf("Can't change notification of another user: %d, %d", notification.UserID, user.ID) + return nil, fmt.Errorf("Can't change notification of another user: %d, %d", notification.UserID, user.ID) } notification.Status = status _, err = x.ID(notificationID).Update(notification) - return err + return notification, err } // GetNotificationByID return notification by ID |