diff --git a/gogs.go b/gogs.go index e7bbb018..e7615c9b 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.5.4.0928 Beta" +const APP_VER = "0.5.4.0929 Beta" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/models/repo.go b/models/repo.go index a157b001..a79c2491 100644 --- a/models/repo.go +++ b/models/repo.go @@ -678,17 +678,25 @@ func TransferOwnership(u *User, newOwner string, repo *Repository) error { return fmt.Errorf("fail to delete current accesses: %v", err) } } else { + // Delete current owner access. if _, err = sess.Where("repo_name=?", oldRepoLink).And("user_name=?", owner.LowerName). - Update(&Access{UserName: newUser.LowerName}); err != nil { + Delete(new(Access)); err != nil { sess.Rollback() - return err + return fmt.Errorf("fail to delete access(owner): %v", err) + } + // In case new owner has access. + if _, err = sess.Where("repo_name=?", oldRepoLink).And("user_name=?", newUser.LowerName). + Delete(new(Access)); err != nil { + sess.Rollback() + return fmt.Errorf("fail to delete access(new user): %v", err) } } + // Change accesses to new repository path. if _, err = sess.Where("repo_name=?", oldRepoLink). Update(&Access{RepoName: path.Join(newUser.LowerName, repo.LowerName)}); err != nil { sess.Rollback() - return err + return fmt.Errorf("fail to update access(change reponame): %v", err) } // Update repository. @@ -754,7 +762,7 @@ func TransferOwnership(u *User, newOwner string, repo *Repository) error { } if _, err = sess.Insert(access); err != nil { sess.Rollback() - return err + return fmt.Errorf("fail to insert access: %v", err) } } diff --git a/templates/.VERSION b/templates/.VERSION index 583b3b81..2d0d24c2 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.5.4.0928 Beta \ No newline at end of file +0.5.4.0929 Beta \ No newline at end of file diff --git a/templates/repo/sidebar.tmpl b/templates/repo/sidebar.tmpl index d43e3606..7a00dbb8 100644 --- a/templates/repo/sidebar.tmpl +++ b/templates/repo/sidebar.tmpl @@ -20,9 +20,11 @@ + {{if .IsRepositoryTrueOwner}}