summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-09-29 04:04:48 -0400
committerUnknwon <joe2010xtmf@163.com>2014-09-29 04:04:48 -0400
commit3cfa4a581ca3cf3cb5e5105725d77f4c594de478 (patch)
tree0f2f065f090e286eaec08be41204370522debdff
parentce6931a046423bb0ef6420c9df670315446153bd (diff)
downloadgitea-3cfa4a581ca3cf3cb5e5105725d77f4c594de478.tar.gz
gitea-3cfa4a581ca3cf3cb5e5105725d77f4c594de478.zip
Bug: 500 when transfer repository to collaborator
-rw-r--r--gogs.go2
-rw-r--r--models/repo.go16
-rw-r--r--templates/.VERSION2
-rw-r--r--templates/repo/sidebar.tmpl2
4 files changed, 16 insertions, 6 deletions
diff --git a/gogs.go b/gogs.go
index e7bbb01877..e7615c9b2b 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 a157b0012a..a79c2491ce 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 583b3b81ba..2d0d24c2ed 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 d43e36063d..7a00dbb8c3 100644
--- a/templates/repo/sidebar.tmpl
+++ b/templates/repo/sidebar.tmpl
@@ -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> \ No newline at end of file