summaryrefslogtreecommitdiffstats
path: root/routers/user
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-03-17 21:51:39 -0400
committerUnknwon <u@gogs.io>2015-03-17 21:51:39 -0400
commit466facc0097bf636b6a945a0daebb7c4c5c33c91 (patch)
tree614c2782ff5b59dd40cea9a9caadb93d46570258 /routers/user
parent33894591a6d391674e938d018801d88d0011f0b7 (diff)
downloadgitea-466facc0097bf636b6a945a0daebb7c4c5c33c91.tar.gz
gitea-466facc0097bf636b6a945a0daebb7c4c5c33c91.zip
#1067: Deleting users should remove them from collaborator lists
- fix delete user but repository watches are not decreased
Diffstat (limited to 'routers/user')
-rw-r--r--routers/user/home.go4
-rw-r--r--routers/user/setting.go15
2 files changed, 6 insertions, 13 deletions
diff --git a/routers/user/home.go b/routers/user/home.go
index d690b3a7c5..86e907e349 100644
--- a/routers/user/home.go
+++ b/routers/user/home.go
@@ -104,7 +104,7 @@ func Dashboard(ctx *middleware.Context) {
for _, act := range actions {
if act.IsPrivate {
// This prevents having to retrieve the repository for each action
- repo := &models.Repository{Id: act.RepoId, IsPrivate: true}
+ repo := &models.Repository{Id: act.RepoID, IsPrivate: true}
if act.RepoUserName != ctx.User.LowerName {
if has, _ := models.HasAccess(ctx.User, repo, models.ACCESS_MODE_READ); !has {
continue
@@ -216,7 +216,7 @@ func Profile(ctx *middleware.Context) {
continue
}
// This prevents having to retrieve the repository for each action
- repo := &models.Repository{Id: act.RepoId, IsPrivate: true}
+ repo := &models.Repository{Id: act.RepoID, IsPrivate: true}
if act.RepoUserName != ctx.User.LowerName {
if has, _ := models.HasAccess(ctx.User, repo, models.ACCESS_MODE_READ); !has {
continue
diff --git a/routers/user/setting.go b/routers/user/setting.go
index a44d3b7e5d..8d8ad0ad8e 100644
--- a/routers/user/setting.go
+++ b/routers/user/setting.go
@@ -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: