diff options
| author | 2023-03-04 14:53:21 +0000 | |
|---|---|---|
| committer | 2023-03-04 14:53:21 +0000 | |
| commit | ef074752d0944fcfca9abe60795a1b0d448489c9 (patch) | |
| tree | c1e230498531604f26e926dcddf227e47c117581 | |
| parent | [performance] cache media attachments (#1525) (diff) | |
| download | gotosocial-ef074752d0944fcfca9abe60795a1b0d448489c9.tar.xz | |
use updateattachment when updating to ensure cache is invalidated (#1587)
Signed-off-by: kim <grufwub@gmail.com>
| -rw-r--r-- | internal/processing/media/update.go | 4 | 
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/processing/media/update.go b/internal/processing/media/update.go index cf49168f0..ba5497728 100644 --- a/internal/processing/media/update.go +++ b/internal/processing/media/update.go @@ -45,7 +45,7 @@ func (p *Processor) Update(ctx context.Context, account *gtsmodel.Account, media  		return nil, gtserror.NewErrorNotFound(errors.New("attachment not owned by requesting account"))  	} -	updatingColumns := []string{} +	var updatingColumns []string  	if form.Description != nil {  		attachment.Description = text.SanitizePlaintext(*form.Description) @@ -62,7 +62,7 @@ func (p *Processor) Update(ctx context.Context, account *gtsmodel.Account, media  		updatingColumns = append(updatingColumns, "focus_x", "focus_y")  	} -	if err := p.state.DB.UpdateByID(ctx, attachment, attachment.ID, updatingColumns...); err != nil { +	if err := p.state.DB.UpdateAttachment(ctx, attachment, updatingColumns...); err != nil {  		return nil, gtserror.NewErrorInternalError(fmt.Errorf("database error updating media: %s", err))  	}  | 
