#1067: Deleting users should remove them from collaborator lists

- fix delete user but repository watches are not decreased
This commit is contained in:
Unknwon 2015-03-17 21:51:39 -04:00
parent 33894591a6
commit 466facc009
13 changed files with 175 additions and 109 deletions

View file

@ -451,20 +451,13 @@ func SettingsDelete(ctx *middleware.Context) {
ctx.Data["PageIsSettingsDelete"] = true
if ctx.Req.Method == "POST" {
// tmpUser := models.User{
// Passwd: ctx.Query("password"),
// Salt: ctx.User.Salt,
// }
// tmpUser.EncodePasswd()
// if tmpUser.Passwd != ctx.User.Passwd {
// ctx.Flash.Error("Password is not correct. Make sure you are owner of this account.")
// } else {
// FIXME: validate password.
if err := models.DeleteUser(ctx.User); err != nil {
switch err {
case models.ErrUserOwnRepos:
switch {
case models.IsErrUserOwnRepos(err):
ctx.Flash.Error(ctx.Tr("form.still_own_repo"))
ctx.Redirect(setting.AppSubUrl + "/user/settings/delete")
case models.ErrUserHasOrgs:
case models.IsErrUserHasOrgs(err):
ctx.Flash.Error(ctx.Tr("form.still_has_org"))
ctx.Redirect(setting.AppSubUrl + "/user/settings/delete")
default: