From af14bcbb7804334552a3b5d369b2a13f65b0f93f Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Sat, 8 Feb 2020 13:51:38 -0500 Subject: [PATCH] Clean up oauth_users table on account deletion Ref T319 --- database.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/database.go b/database.go index 757a371..2c44492 100644 --- a/database.go +++ b/database.go @@ -2217,6 +2217,16 @@ func (db *datastore) DeleteAccount(userID int64) error { rs, _ = res.RowsAffected() log.Info("Deleted %d from accesstokens", rs) + // Delete user attributes + res, err = t.Exec("DELETE FROM oauth_users WHERE user_id = ?", userID) + if err != nil { + t.Rollback() + log.Error("Unable to delete oauth_users: %v", err) + return err + } + rs, _ = res.RowsAffected() + log.Info("Deleted %d from oauth_users", rs) + // Delete posts // TODO: should maybe get each row so we can federate a delete // if so needs to be outside of transaction like collections