mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-12-16 20:26:28 +00:00
25 lines
696 B
Go
25 lines
696 B
Go
|
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
|
||
|
}
|