diff options
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/models/repo.go b/models/repo.go index cd861d7500..86d3e44a1f 100644 --- a/models/repo.go +++ b/models/repo.go @@ -776,7 +776,11 @@ func (repo *Repository) UpdateLocalCopyBranch(branch string) error { // PatchPath returns corresponding patch file path of repository by given issue ID. func (repo *Repository) PatchPath(index int64) (string, error) { - if err := repo.GetOwner(); err != nil { + return repo.patchPath(x, index) +} + +func (repo *Repository) patchPath(e Engine, index int64) (string, error) { + if err := repo.getOwner(e); err != nil { return "", err } @@ -785,7 +789,11 @@ func (repo *Repository) PatchPath(index int64) (string, error) { // SavePatch saves patch data to corresponding location by given issue ID. func (repo *Repository) SavePatch(index int64, patch []byte) error { - patchPath, err := repo.PatchPath(index) + return repo.savePatch(x, index, patch) +} + +func (repo *Repository) savePatch(e Engine, index int64, patch []byte) error { + patchPath, err := repo.patchPath(e, index) if err != nil { return fmt.Errorf("PatchPath: %v", err) } @@ -1479,7 +1487,7 @@ func TransferOwnership(doer *User, newOwnerName string, repo *Repository) error collaboration := &Collaboration{RepoID: repo.ID} for _, c := range collaborators { if c.ID != newOwner.ID { - isMember, err := newOwner.IsOrgMember(c.ID) + isMember, err := isOrganizationMember(sess, newOwner.ID, c.ID) if err != nil { return fmt.Errorf("IsOrgMember: %v", err) } else if !isMember { @@ -1536,12 +1544,12 @@ func TransferOwnership(doer *User, newOwnerName string, repo *Repository) error if err = os.Rename(RepoPath(owner.Name, repo.Name), RepoPath(newOwner.Name, repo.Name)); err != nil { return fmt.Errorf("rename repository directory: %v", err) } - RemoveAllWithNotice("Delete repository local copy", repo.LocalCopyPath()) + removeAllWithNotice(sess, "Delete repository local copy", repo.LocalCopyPath()) // Rename remote wiki repository to new path and delete local copy. wikiPath := WikiPath(owner.Name, repo.Name) if com.IsExist(wikiPath) { - RemoveAllWithNotice("Delete repository wiki local copy", repo.LocalWikiPath()) + removeAllWithNotice(sess, "Delete repository wiki local copy", repo.LocalWikiPath()) if err = os.Rename(wikiPath, WikiPath(newOwner.Name, repo.Name)); err != nil { return fmt.Errorf("rename repository wiki: %v", err) } |