1
0
Fork 0

Bug: 500 when transfer repository to collaborator

This commit is contained in:
Unknwon 2014-09-29 04:04:48 -04:00
parent ce6931a046
commit 3cfa4a581c
4 changed files with 16 additions and 6 deletions

View file

@ -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())

View file

@ -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)
}
}

View file

@ -1 +1 @@
0.5.4.0928 Beta
0.5.4.0929 Beta

View file

@ -20,9 +20,11 @@
<!-- <li>
<a class="radius" href="#"><i class="octicon octicon-organization"></i>contributors <span class="num right label label-gray label-radius">43</span></a>
</li> -->
{{if .IsRepositoryTrueOwner}}
<li class="border-bottom"></li>
<li>
<a class="radius" href="{{.RepoLink}}/settings"><i class="octicon octicon-tools"></i>{{.i18n.Tr "repo.settings"}}</a>
</li>
{{end}}
</ul>
</div>