From 50b65a517da6869dc6a48fec40323e254ba4c032 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 16 Oct 2021 17:00:48 +0200 Subject: [PATCH] fix: correctly load and pass the user when deleting it Fixes #984 --- pkg/cmd/user.go | 2 +- pkg/models/user_delete.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/user.go b/pkg/cmd/user.go index 8c4dd796..b1d5939a 100644 --- a/pkg/cmd/user.go +++ b/pkg/cmd/user.go @@ -103,7 +103,7 @@ func getUserFromArg(s *xorm.Session, arg string) *user.User { log.Fatalf("Invalid user id: %s", err) } - u, err := user.GetUserByID(s, id) + u, err := user.GetUserWithEmail(s, &user.User{ID: id}) if err != nil { log.Fatalf("Could not get user: %s", err) } diff --git a/pkg/models/user_delete.go b/pkg/models/user_delete.go index 32b4d14d..f0f67fa1 100644 --- a/pkg/models/user_delete.go +++ b/pkg/models/user_delete.go @@ -167,7 +167,9 @@ func DeleteUser(s *xorm.Session, u *user.User) (err error) { return err } - return notifications.Notify(u, &user.AccountDeletedNotification{}) + return notifications.Notify(u, &user.AccountDeletedNotification{ + User: u, + }) } func ensureNamespaceAdminUser(s *xorm.Session, n *Namespace) (hadUsers bool, err error) {