parent
e8bac94d1f
commit
fbb424c61d
|
@ -206,12 +206,9 @@ func Organizations(page, pageSize int) ([]*User, error) {
|
||||||
|
|
||||||
// DeleteOrganization completely and permanently deletes everything of organization.
|
// DeleteOrganization completely and permanently deletes everything of organization.
|
||||||
func DeleteOrganization(org *User) (err error) {
|
func DeleteOrganization(org *User) (err error) {
|
||||||
if err := DeleteUser(org); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
sess := x.NewSession()
|
sess := x.NewSession()
|
||||||
defer sessionRelease(sess)
|
defer sess.Close()
|
||||||
|
|
||||||
if err = sess.Begin(); err != nil {
|
if err = sess.Begin(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -228,7 +225,11 @@ func DeleteOrganization(org *User) (err error) {
|
||||||
return fmt.Errorf("deleteUser: %v", err)
|
return fmt.Errorf("deleteUser: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return sess.Commit()
|
if err = sess.Commit(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return RewriteAllPublicKeys()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ________ ____ ___
|
// ________ ____ ___
|
||||||
|
|
|
@ -885,9 +885,11 @@ func deleteUser(e *xorm.Session, u *User) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
avatarPath := u.CustomAvatarPath()
|
avatarPath := u.CustomAvatarPath()
|
||||||
|
if com.IsExist(avatarPath) {
|
||||||
if err := os.Remove(avatarPath); err != nil {
|
if err := os.Remove(avatarPath); err != nil {
|
||||||
return fmt.Errorf("Fail to remove %s: %v", avatarPath, err)
|
return fmt.Errorf("Fail to remove %s: %v", avatarPath, err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user