mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2024-11-23 12:53:23 +00:00
use updateattachment when updating to ensure cache is invalidated (#1587)
Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
a8e6bdfa33
commit
ef074752d0
1 changed files with 2 additions and 2 deletions
|
@ -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"))
|
return nil, gtserror.NewErrorNotFound(errors.New("attachment not owned by requesting account"))
|
||||||
}
|
}
|
||||||
|
|
||||||
updatingColumns := []string{}
|
var updatingColumns []string
|
||||||
|
|
||||||
if form.Description != nil {
|
if form.Description != nil {
|
||||||
attachment.Description = text.SanitizePlaintext(*form.Description)
|
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")
|
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))
|
return nil, gtserror.NewErrorInternalError(fmt.Errorf("database error updating media: %s", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue