summaryrefslogtreecommitdiff
path: root/internal/processing/account/delete.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-11-08 14:32:17 +0000
committerLibravatar GitHub <noreply@github.com>2023-11-08 14:32:17 +0000
commite9e5dc5a40926e5320cb131b035c46b1e1b0bd59 (patch)
tree52edc9fa5742f28e1e5223f51cda628ec1c35a24 /internal/processing/account/delete.go
parent[chore]: Bump github.com/spf13/cobra from 1.7.0 to 1.8.0 (#2338) (diff)
downloadgotosocial-e9e5dc5a40926e5320cb131b035c46b1e1b0bd59.tar.xz
[feature] add support for polls + receiving federated status edits (#2330)
Diffstat (limited to 'internal/processing/account/delete.go')
-rw-r--r--internal/processing/account/delete.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/internal/processing/account/delete.go b/internal/processing/account/delete.go
index e89ebf13f..bf1ea2f44 100644
--- a/internal/processing/account/delete.go
+++ b/internal/processing/account/delete.go
@@ -387,12 +387,12 @@ statusLoop:
func (p *Processor) deleteAccountNotifications(ctx context.Context, account *gtsmodel.Account) error {
// Delete all notifications of all types targeting given account.
if err := p.state.DB.DeleteNotifications(ctx, nil, account.ID, ""); err != nil && !errors.Is(err, db.ErrNoEntries) {
- return err
+ return gtserror.Newf("error deleting notifications targeting account: %w", err)
}
// Delete all notifications of all types originating from given account.
if err := p.state.DB.DeleteNotifications(ctx, nil, "", account.ID); err != nil && !errors.Is(err, db.ErrNoEntries) {
- return err
+ return gtserror.Newf("error deleting notifications by account: %w", err)
}
return nil
@@ -402,29 +402,35 @@ func (p *Processor) deleteAccountPeripheral(ctx context.Context, account *gtsmod
// Delete all bookmarks owned by given account.
if err := p.state.DB.DeleteStatusBookmarks(ctx, account.ID, ""); // nocollapse
err != nil && !errors.Is(err, db.ErrNoEntries) {
- return err
+ return gtserror.Newf("error deleting bookmarks by account: %w", err)
}
// Delete all bookmarks targeting given account.
if err := p.state.DB.DeleteStatusBookmarks(ctx, "", account.ID); // nocollapse
err != nil && !errors.Is(err, db.ErrNoEntries) {
- return err
+ return gtserror.Newf("error deleting bookmarks targeting account: %w", err)
}
// Delete all faves owned by given account.
if err := p.state.DB.DeleteStatusFaves(ctx, account.ID, ""); // nocollapse
err != nil && !errors.Is(err, db.ErrNoEntries) {
- return err
+ return gtserror.Newf("error deleting faves by account: %w", err)
}
// Delete all faves targeting given account.
if err := p.state.DB.DeleteStatusFaves(ctx, "", account.ID); // nocollapse
err != nil && !errors.Is(err, db.ErrNoEntries) {
- return err
+ return gtserror.Newf("error deleting faves targeting account: %w", err)
}
// TODO: add status mutes here when they're implemented.
+ // Delete all poll votes owned by given account.
+ if err := p.state.DB.DeletePollVotesByAccountID(ctx, account.ID); // nocollapse
+ err != nil && !errors.Is(err, db.ErrNoEntries) {
+ return gtserror.Newf("error deleting poll votes by account: %w", err)
+ }
+
return nil
}