summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/media/prune.go6
-rw-r--r--internal/processing/account_test.go2
-rw-r--r--internal/processing/media/unattach.go5
3 files changed, 4 insertions, 9 deletions
diff --git a/internal/media/prune.go b/internal/media/prune.go
index da842a84d..f0d0516e1 100644
--- a/internal/media/prune.go
+++ b/internal/media/prune.go
@@ -328,10 +328,8 @@ func (m *manager) uncacheAttachment(ctx context.Context, attachment *gtsmodel.Me
}
// Update attachment to reflect that we no longer have it cached.
- attachment.UpdatedAt = time.Now()
- cached := false
- attachment.Cached = &cached
- return m.state.DB.UpdateAttachment(ctx, attachment, "updated_at", "cached")
+ attachment.Cached = func() *bool { i := false; return &i }()
+ return m.state.DB.UpdateAttachment(ctx, attachment, "cached")
}
func (m *manager) removeFiles(ctx context.Context, keys ...string) (int, error) {
diff --git a/internal/processing/account_test.go b/internal/processing/account_test.go
index fb66d7d0a..83eebedba 100644
--- a/internal/processing/account_test.go
+++ b/internal/processing/account_test.go
@@ -88,7 +88,7 @@ func (suite *AccountTestSuite) TestAccountDeleteLocal() {
if !testrig.WaitFor(func() bool {
dbAccount, _ := suite.db.GetAccountByID(ctx, deletingAccount.ID)
- return suite.WithinDuration(dbAccount.SuspendedAt, time.Now(), 30*time.Second)
+ return !dbAccount.SuspendedAt.IsZero()
}) {
suite.FailNow("timed out waiting for account to be deleted")
}
diff --git a/internal/processing/media/unattach.go b/internal/processing/media/unattach.go
index 8cdaf80b2..c6eeac604 100644
--- a/internal/processing/media/unattach.go
+++ b/internal/processing/media/unattach.go
@@ -21,7 +21,6 @@ import (
"context"
"errors"
"fmt"
- "time"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
"github.com/superseriousbusiness/gotosocial/internal/db"
@@ -44,11 +43,9 @@ func (p *Processor) Unattach(ctx context.Context, account *gtsmodel.Account, med
return nil, gtserror.NewErrorNotFound(errors.New("attachment not owned by requesting account"))
}
- updatingColumns := []string{"updated_at", "status_id"}
- attachment.UpdatedAt = time.Now()
attachment.StatusID = ""
- if err := p.state.DB.UpdateAttachment(ctx, attachment, updatingColumns...); err != nil {
+ if err := p.state.DB.UpdateAttachment(ctx, attachment, "status_id"); err != nil {
return nil, gtserror.NewErrorNotFound(fmt.Errorf("db error updating attachment: %s", err))
}