mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-01 15:00:00 +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
|
||
|
}
|