mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-19 09:17:28 -06:00
start work on notifications
This commit is contained in:
parent
e670c32a91
commit
5853179728
17 changed files with 437 additions and 5 deletions
24
internal/message/notificationsprocess.go
Normal file
24
internal/message/notificationsprocess.go
Normal file
|
|
@ -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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue