mirror of
https://github.com/go-gitea/gitea
synced 2024-11-25 01:32:47 +01:00
fix 500 when delete orgnization and resolved #486
This commit is contained in:
parent
59f736d54c
commit
ba134bd27a
2 changed files with 11 additions and 8 deletions
|
@ -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()
|
||||
}
|
||||
|
||||
// ________ ____ ___
|
||||
|
|
|
@ -891,9 +891,11 @@ func deleteUser(e *xorm.Session, u *User) error {
|
|||
}
|
||||
|
||||
avatarPath := u.CustomAvatarPath()
|
||||
if com.IsExist(avatarPath) {
|
||||
if err := os.Remove(avatarPath); err != nil {
|
||||
return fmt.Errorf("Fail to remove %s: %v", avatarPath, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue