diff options
author | 2023-02-22 16:05:26 +0100 | |
---|---|---|
committer | 2023-02-22 16:05:26 +0100 | |
commit | b6fbdc66c1ce1ec61ebfb6fcc0351ea627a1d288 (patch) | |
tree | c79d1107375597ab8a79045c80dd62dc95a204e7 /internal/processing/account/update.go | |
parent | [bugfix] Remove initial storage cleanup (#1545) (diff) | |
download | gotosocial-b6fbdc66c1ce1ec61ebfb6fcc0351ea627a1d288.tar.xz |
[chore] Deinterface processor and subprocessors (#1501)
* [chore] Deinterface processor and subprocessors
* expose subprocessors via function calls
* missing license header
Diffstat (limited to 'internal/processing/account/update.go')
-rw-r--r-- | internal/processing/account/update.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/internal/processing/account/update.go b/internal/processing/account/update.go index e6867bfd3..cffbbb0c5 100644 --- a/internal/processing/account/update.go +++ b/internal/processing/account/update.go @@ -33,10 +33,12 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/media" "github.com/superseriousbusiness/gotosocial/internal/messages" "github.com/superseriousbusiness/gotosocial/internal/text" + "github.com/superseriousbusiness/gotosocial/internal/typeutils" "github.com/superseriousbusiness/gotosocial/internal/validate" ) -func (p *processor) Update(ctx context.Context, account *gtsmodel.Account, form *apimodel.UpdateCredentialsRequest) (*apimodel.Account, gtserror.WithCode) { +// Update processes the update of an account with the given form. +func (p *Processor) Update(ctx context.Context, account *gtsmodel.Account, form *apimodel.UpdateCredentialsRequest) (*apimodel.Account, gtserror.WithCode) { if form.Discoverable != nil { account.Discoverable = form.Discoverable } @@ -138,7 +140,7 @@ func (p *processor) Update(ctx context.Context, account *gtsmodel.Account, form if err := validate.Privacy(*form.Source.Privacy); err != nil { return nil, gtserror.NewErrorBadRequest(err) } - privacy := p.tc.APIVisToVis(apimodel.Visibility(*form.Source.Privacy)) + privacy := typeutils.APIVisToVis(apimodel.Visibility(*form.Source.Privacy)) account.Privacy = privacy } @@ -185,7 +187,7 @@ func (p *processor) Update(ctx context.Context, account *gtsmodel.Account, form // UpdateAvatar does the dirty work of checking the avatar part of an account update form, // parsing and checking the image, and doing the necessary updates in the database for this to become // the account's new avatar image. -func (p *processor) UpdateAvatar(ctx context.Context, avatar *multipart.FileHeader, description *string, accountID string) (*gtsmodel.MediaAttachment, error) { +func (p *Processor) UpdateAvatar(ctx context.Context, avatar *multipart.FileHeader, description *string, accountID string) (*gtsmodel.MediaAttachment, error) { maxImageSize := config.GetMediaImageMaxSize() if avatar.Size > int64(maxImageSize) { return nil, fmt.Errorf("UpdateAvatar: avatar with size %d exceeded max image size of %d bytes", avatar.Size, maxImageSize) @@ -213,7 +215,7 @@ func (p *processor) UpdateAvatar(ctx context.Context, avatar *multipart.FileHead // UpdateHeader does the dirty work of checking the header part of an account update form, // parsing and checking the image, and doing the necessary updates in the database for this to become // the account's new header image. -func (p *processor) UpdateHeader(ctx context.Context, header *multipart.FileHeader, description *string, accountID string) (*gtsmodel.MediaAttachment, error) { +func (p *Processor) UpdateHeader(ctx context.Context, header *multipart.FileHeader, description *string, accountID string) (*gtsmodel.MediaAttachment, error) { maxImageSize := config.GetMediaImageMaxSize() if header.Size > int64(maxImageSize) { return nil, fmt.Errorf("UpdateHeader: header with size %d exceeded max image size of %d bytes", header.Size, maxImageSize) |