diff options
Diffstat (limited to 'internal/message/notificationsprocess.go')
-rw-r--r-- | internal/message/notificationsprocess.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/message/notificationsprocess.go b/internal/message/notificationsprocess.go new file mode 100644 index 000000000..64726b75f --- /dev/null +++ b/internal/message/notificationsprocess.go @@ -0,0 +1,24 @@ +package message + +import ( + apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" + "github.com/superseriousbusiness/gotosocial/internal/oauth" +) + +func (p *processor) NotificationsGet(authed *oauth.Auth, limit int, maxID string) ([]*apimodel.Notification, ErrorWithCode) { + notifs, err := p.db.GetNotificationsForAccount(authed.Account.ID, limit, maxID) + if err != nil { + return nil, NewErrorInternalError(err) + } + + mastoNotifs := []*apimodel.Notification{} + for _, n := range notifs { + mastoNotif, err := p.tc.NotificationToMasto(n) + if err != nil { + return nil, NewErrorInternalError(err) + } + mastoNotifs = append(mastoNotifs, mastoNotif) + } + + return mastoNotifs, nil +} |