summaryrefslogtreecommitdiffstats
path: root/models/org.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2016-12-27 10:02:14 +0800
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2016-12-27 12:00:12 +0100
commitba134bd27abe099efcd748773c410b3aa78521fc (patch)
tree8468ddbd61dd7af49a9fbf50bc71179ee6b9b21c /models/org.go
parent59f736d54c3edf7072b5adc9193896e039f6d8e7 (diff)
downloadgitea-ba134bd27abe099efcd748773c410b3aa78521fc.tar.gz
gitea-ba134bd27abe099efcd748773c410b3aa78521fc.zip
fix 500 when delete orgnization and resolved #486
Diffstat (limited to 'models/org.go')
-rw-r--r--models/org.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/models/org.go b/models/org.go
index b302288ca5..43a3e094f1 100644
--- a/models/org.go
+++ b/models/org.go
@@ -213,12 +213,9 @@ func Organizations(opts *SearchUserOptions) ([]*User, error) {
// DeleteOrganization completely and permanently deletes everything of organization.
func DeleteOrganization(org *User) (err error) {
- if err := DeleteUser(org); err != nil {
- return err
- }
-
sess := x.NewSession()
- defer sessionRelease(sess)
+ defer sess.Close()
+
if err = sess.Begin(); err != nil {
return err
}
@@ -235,7 +232,11 @@ func DeleteOrganization(org *User) (err error) {
return fmt.Errorf("deleteUser: %v", err)
}
- return sess.Commit()
+ if err = sess.Commit(); err != nil {
+ return err
+ }
+
+ return RewriteAllPublicKeys()
}
// ________ ____ ___