From 1fe29c7c433e90085b9d5564608a4d30def4e3e6 Mon Sep 17 00:00:00 2001 From: Vyr Cossont Date: Sat, 30 Nov 2024 18:18:29 -0800 Subject: [PATCH] Delete Web Push subscriptions when account is deleted --- internal/processing/account/delete.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/processing/account/delete.go b/internal/processing/account/delete.go index c8d1ba5f9..2618fdfc5 100644 --- a/internal/processing/account/delete.go +++ b/internal/processing/account/delete.go @@ -96,7 +96,7 @@ func (p *Processor) Delete( } // deleteUserAndTokensForAccount deletes the gtsmodel.User and -// any OAuth tokens and applications for the given account. +// any OAuth tokens, applications, and Web Push subscriptions for the given account. // // Callers to this function should already have checked that // this is a local account, or else it won't have a user associated @@ -129,6 +129,10 @@ func (p *Processor) deleteUserAndTokensForAccount(ctx context.Context, account * } } + if err := p.state.DB.DeleteWebPushSubscriptionsByAccountID(ctx, account.ID); err != nil { + return gtserror.Newf("db error deleting Web Push subscriptions: %w", err) + } + columns, err := stubbifyUser(user) if err != nil { return gtserror.Newf("error stubbifying user: %w", err)