mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-27 17:13:31 -06:00
follow requests prettymuch working
This commit is contained in:
parent
2453957a6e
commit
d68c64505b
15 changed files with 520 additions and 16 deletions
42
internal/message/frprocess.go
Normal file
42
internal/message/frprocess.go
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package message
|
||||
|
||||
import (
|
||||
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/db"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/oauth"
|
||||
)
|
||||
|
||||
func (p *processor) FollowRequestsGet(auth *oauth.Auth) ([]apimodel.Account, ErrorWithCode) {
|
||||
frs := []gtsmodel.FollowRequest{}
|
||||
if err := p.db.GetFollowRequestsForAccountID(auth.Account.ID, &frs); err != nil {
|
||||
if _, ok := err.(db.ErrNoEntries); !ok {
|
||||
return nil, NewErrorInternalError(err)
|
||||
}
|
||||
}
|
||||
|
||||
accts := []apimodel.Account{}
|
||||
for _, fr := range frs {
|
||||
acct := >smodel.Account{}
|
||||
if err := p.db.GetByID(fr.AccountID, acct); err != nil {
|
||||
return nil, NewErrorInternalError(err)
|
||||
}
|
||||
mastoAcct, err := p.tc.AccountToMastoPublic(acct)
|
||||
if err != nil {
|
||||
return nil, NewErrorInternalError(err)
|
||||
}
|
||||
accts = append(accts, *mastoAcct)
|
||||
}
|
||||
return accts, nil
|
||||
}
|
||||
|
||||
func (p *processor) FollowRequestAccept(auth *oauth.Auth, accountID string) ErrorWithCode {
|
||||
if err := p.db.AcceptFollowRequest(accountID, auth.Account.ID); err != nil {
|
||||
return NewErrorNotFound(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *processor) FollowRequestDeny(auth *oauth.Auth) ErrorWithCode {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -81,6 +81,11 @@ type Processor interface {
|
|||
// FileGet handles the fetching of a media attachment file via the fileserver.
|
||||
FileGet(authed *oauth.Auth, form *apimodel.GetContentRequestForm) (*apimodel.Content, error)
|
||||
|
||||
// FollowRequestsGet handles the getting of the authed account's incoming follow requests
|
||||
FollowRequestsGet(auth *oauth.Auth) ([]apimodel.Account, ErrorWithCode)
|
||||
// FollowRequestAccept handles the acceptance of a follow request from the given account ID
|
||||
FollowRequestAccept(auth *oauth.Auth, accountID string) ErrorWithCode
|
||||
|
||||
// InstanceGet retrieves instance information for serving at api/v1/instance
|
||||
InstanceGet(domain string) (*apimodel.Instance, ErrorWithCode)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue