mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 19:42:25 -05:00
[feature] Account alias / move API + db models (#2518)
* [feature] Account alias / move API + db models * go fmt * fix little cherry-pick issues * update error checking, formatting * add and use new util functions to simplify alias logic
This commit is contained in:
parent
ebf550b7c1
commit
c36f9ac37b
23 changed files with 1243 additions and 39 deletions
|
|
@ -162,6 +162,23 @@ func (p *Processor) GetAPIAccountBlocked(
|
|||
return apiAccount, nil
|
||||
}
|
||||
|
||||
// GetAPIAccountSensitive fetches the "sensitive" account model for the given target.
|
||||
// *BE CAREFUL!* Only return a sensitive account if targetAcc == account making the request.
|
||||
func (p *Processor) GetAPIAccountSensitive(
|
||||
ctx context.Context,
|
||||
targetAcc *gtsmodel.Account,
|
||||
) (
|
||||
apiAcc *apimodel.Account,
|
||||
errWithCode gtserror.WithCode,
|
||||
) {
|
||||
apiAccount, err := p.converter.AccountToAPIAccountSensitive(ctx, targetAcc)
|
||||
if err != nil {
|
||||
err = gtserror.Newf("error converting account: %w", err)
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
return apiAccount, nil
|
||||
}
|
||||
|
||||
// GetVisibleAPIAccounts converts an array of gtsmodel.Accounts (inputted by next function) into
|
||||
// public API model accounts, checking first for visibility. Please note that all errors will be
|
||||
// logged at ERROR level, but will not be returned. Callers are likely to run into show-stopping
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue