mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2026-01-05 07:43:15 -06:00
some more updates
This commit is contained in:
parent
b95db2bd8f
commit
58f71fa1a5
27 changed files with 417 additions and 186 deletions
|
|
@ -34,16 +34,16 @@ func (p *processor) FollowersGet(requestingAccount *gtsmodel.Account, targetAcco
|
|||
return nil, gtserror.NewErrorNotFound(fmt.Errorf("block exists between accounts"))
|
||||
}
|
||||
|
||||
followers := []gtsmodel.Follow{}
|
||||
accounts := []apimodel.Account{}
|
||||
if err := p.db.GetAccountFollowers(targetAccountID, &followers, false); err != nil {
|
||||
follows, err := p.db.GetAccountFollowedBy(targetAccountID, false)
|
||||
if err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
return accounts, nil
|
||||
}
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
|
||||
for _, f := range followers {
|
||||
for _, f := range follows {
|
||||
blocked, err := p.db.IsBlocked(requestingAccount.ID, f.AccountID, true)
|
||||
if err != nil {
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
|
|
@ -52,15 +52,18 @@ func (p *processor) FollowersGet(requestingAccount *gtsmodel.Account, targetAcco
|
|||
continue
|
||||
}
|
||||
|
||||
a := >smodel.Account{}
|
||||
if err := p.db.GetByID(f.AccountID, a); err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
continue
|
||||
if f.Account == nil {
|
||||
a, err := p.db.GetAccountByID(f.AccountID)
|
||||
if err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
continue
|
||||
}
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
f.Account = a
|
||||
}
|
||||
|
||||
account, err := p.tc.AccountToMastoPublic(a)
|
||||
account, err := p.tc.AccountToMastoPublic(f.Account)
|
||||
if err != nil {
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,16 +34,16 @@ func (p *processor) FollowingGet(requestingAccount *gtsmodel.Account, targetAcco
|
|||
return nil, gtserror.NewErrorNotFound(fmt.Errorf("block exists between accounts"))
|
||||
}
|
||||
|
||||
following := []gtsmodel.Follow{}
|
||||
accounts := []apimodel.Account{}
|
||||
if err := p.db.GetAccountFollows(targetAccountID, &following); err != nil {
|
||||
follows, err := p.db.GetAccountFollows(targetAccountID)
|
||||
if err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
return accounts, nil
|
||||
}
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
|
||||
for _, f := range following {
|
||||
for _, f := range follows {
|
||||
blocked, err := p.db.IsBlocked(requestingAccount.ID, f.AccountID, true)
|
||||
if err != nil {
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
|
|
@ -52,15 +52,18 @@ func (p *processor) FollowingGet(requestingAccount *gtsmodel.Account, targetAcco
|
|||
continue
|
||||
}
|
||||
|
||||
a := >smodel.Account{}
|
||||
if err := p.db.GetByID(f.TargetAccountID, a); err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
continue
|
||||
if f.TargetAccount == nil {
|
||||
a, err := p.db.GetAccountByID(f.TargetAccountID)
|
||||
if err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
continue
|
||||
}
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
f.TargetAccount = a
|
||||
}
|
||||
|
||||
account, err := p.tc.AccountToMastoPublic(a)
|
||||
account, err := p.tc.AccountToMastoPublic(f.TargetAccount)
|
||||
if err != nil {
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue