mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 19:32:26 -05:00
[chore] Deinterface processor and subprocessors (#1501)
* [chore] Deinterface processor and subprocessors * expose subprocessors via function calls * missing license header
This commit is contained in:
parent
adb596600b
commit
b6fbdc66c1
246 changed files with 2545 additions and 4549 deletions
|
|
@ -31,7 +31,8 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/transport"
|
||||
)
|
||||
|
||||
func (p *processor) Get(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccountID string) (*apimodel.Account, gtserror.WithCode) {
|
||||
// Get processes the given request for account information.
|
||||
func (p *Processor) Get(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccountID string) (*apimodel.Account, gtserror.WithCode) {
|
||||
targetAccount, err := p.db.GetAccountByID(ctx, targetAccountID)
|
||||
if err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
|
|
@ -40,10 +41,11 @@ func (p *processor) Get(ctx context.Context, requestingAccount *gtsmodel.Account
|
|||
return nil, gtserror.NewErrorInternalError(fmt.Errorf("db error: %s", err))
|
||||
}
|
||||
|
||||
return p.getAccountFor(ctx, requestingAccount, targetAccount)
|
||||
return p.getFor(ctx, requestingAccount, targetAccount)
|
||||
}
|
||||
|
||||
func (p *processor) GetLocalByUsername(ctx context.Context, requestingAccount *gtsmodel.Account, username string) (*apimodel.Account, gtserror.WithCode) {
|
||||
// GetLocalByUsername processes the given request for account information targeting a local account by username.
|
||||
func (p *Processor) GetLocalByUsername(ctx context.Context, requestingAccount *gtsmodel.Account, username string) (*apimodel.Account, gtserror.WithCode) {
|
||||
targetAccount, err := p.db.GetAccountByUsernameDomain(ctx, username, "")
|
||||
if err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
|
|
@ -52,10 +54,11 @@ func (p *processor) GetLocalByUsername(ctx context.Context, requestingAccount *g
|
|||
return nil, gtserror.NewErrorInternalError(fmt.Errorf("db error: %s", err))
|
||||
}
|
||||
|
||||
return p.getAccountFor(ctx, requestingAccount, targetAccount)
|
||||
return p.getFor(ctx, requestingAccount, targetAccount)
|
||||
}
|
||||
|
||||
func (p *processor) GetCustomCSSForUsername(ctx context.Context, username string) (string, gtserror.WithCode) {
|
||||
// GetCustomCSSForUsername returns custom css for the given local username.
|
||||
func (p *Processor) GetCustomCSSForUsername(ctx context.Context, username string) (string, gtserror.WithCode) {
|
||||
customCSS, err := p.db.GetAccountCustomCSSByUsername(ctx, username)
|
||||
if err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
|
|
@ -67,7 +70,7 @@ func (p *processor) GetCustomCSSForUsername(ctx context.Context, username string
|
|||
return customCSS, nil
|
||||
}
|
||||
|
||||
func (p *processor) getAccountFor(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccount *gtsmodel.Account) (*apimodel.Account, gtserror.WithCode) {
|
||||
func (p *Processor) getFor(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccount *gtsmodel.Account) (*apimodel.Account, gtserror.WithCode) {
|
||||
var blocked bool
|
||||
var err error
|
||||
if requestingAccount != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue