From 0754dd2f955c70994753cd18228333ca32ceee72 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 16 Mar 2014 06:38:39 -0400 Subject: [PATCH] Add delete all feeds when delete account --- models/user.go | 7 ++++++- routers/user/user.go | 2 +- templates/user/publickey.tmpl | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/models/user.go b/models/user.go index ffeb7252..463d4a27 100644 --- a/models/user.go +++ b/models/user.go @@ -152,7 +152,12 @@ func DeleteUser(user *User) error { // TODO: check issues, other repos' commits - // Delete SSH keys. + // Delete all feeds. + if _, err = orm.Delete(&Action{UserId: user.Id}); err != nil { + return err + } + + // Delete all SSH keys. keys := make([]PublicKey, 0, 10) if err = orm.Find(&keys, &PublicKey{OwnerId: user.Id}); err != nil { return err diff --git a/routers/user/user.go b/routers/user/user.go index e13f6909..b87076d9 100644 --- a/routers/user/user.go +++ b/routers/user/user.go @@ -168,7 +168,7 @@ func Delete(ctx *middleware.Context) { } } - ctx.Render.HTML(200, "user/delete", ctx.Data) + ctx.Render.Redirect("/", 302) } const ( diff --git a/templates/user/publickey.tmpl b/templates/user/publickey.tmpl index b671f63f..3b2cc112 100644 --- a/templates/user/publickey.tmpl +++ b/templates/user/publickey.tmpl @@ -5,7 +5,7 @@

Account Setting