diff options
Diffstat (limited to 'internal/processing/account')
-rw-r--r-- | internal/processing/account/account.go | 11 | ||||
-rw-r--r-- | internal/processing/account/update.go | 11 |
2 files changed, 11 insertions, 11 deletions
diff --git a/internal/processing/account/account.go b/internal/processing/account/account.go index d2c3cddbe..3eccbc27d 100644 --- a/internal/processing/account/account.go +++ b/internal/processing/account/account.go @@ -78,15 +78,14 @@ type Processor interface { BlockCreate(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccountID string) (*apimodel.Relationship, gtserror.WithCode) // BlockRemove handles the removal of a block from requestingAccount to targetAccountID, either remote or local. BlockRemove(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccountID string) (*apimodel.Relationship, gtserror.WithCode) - - // 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. - UpdateAvatar(ctx context.Context, avatar *multipart.FileHeader, accountID string) (*gtsmodel.MediaAttachment, error) // 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. - UpdateHeader(ctx context.Context, header *multipart.FileHeader, accountID string) (*gtsmodel.MediaAttachment, error) + UpdateAvatar(ctx context.Context, avatar *multipart.FileHeader, description *string, accountID string) (*gtsmodel.MediaAttachment, error) + // 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. + UpdateHeader(ctx context.Context, header *multipart.FileHeader, description *string, accountID string) (*gtsmodel.MediaAttachment, error) } type processor struct { diff --git a/internal/processing/account/update.go b/internal/processing/account/update.go index 2ef3bfe25..bce82d6ca 100644 --- a/internal/processing/account/update.go +++ b/internal/processing/account/update.go @@ -100,7 +100,7 @@ func (p *processor) Update(ctx context.Context, account *gtsmodel.Account, form } if form.Avatar != nil && form.Avatar.Size != 0 { - avatarInfo, err := p.UpdateAvatar(ctx, form.Avatar, account.ID) + avatarInfo, err := p.UpdateAvatar(ctx, form.Avatar, nil, account.ID) if err != nil { return nil, gtserror.NewErrorBadRequest(err) } @@ -110,7 +110,7 @@ func (p *processor) Update(ctx context.Context, account *gtsmodel.Account, form } if form.Header != nil && form.Header.Size != 0 { - headerInfo, err := p.UpdateHeader(ctx, form.Header, account.ID) + headerInfo, err := p.UpdateHeader(ctx, form.Header, nil, account.ID) if err != nil { return nil, gtserror.NewErrorBadRequest(err) } @@ -186,7 +186,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, 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) @@ -199,7 +199,8 @@ func (p *processor) UpdateAvatar(ctx context.Context, avatar *multipart.FileHead isAvatar := true ai := &media.AdditionalMediaInfo{ - Avatar: &isAvatar, + Avatar: &isAvatar, + Description: description, } processingMedia, err := p.mediaManager.ProcessMedia(ctx, dataFunc, nil, accountID, ai) @@ -213,7 +214,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, 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) |