gotosocial/internal/message/notificationsprocess.go
Tobi Smethurst 40add68691
Notifications (#34)
Notifications working for:

* Mentions
* Faves
* New follow requests
* New followers
2021-05-27 16:06:24 +02:00

24 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
}