diff options
author | Lunny Xiao | 2019-10-18 16:14:37 +0800 |
---|---|---|
committer | GitHub | 2019-10-18 16:14:37 +0800 |
commit | d4501ece55bd0016740d614fe3e3ad0943a3905c (patch) | |
tree | 46d76164b27f426633b697e360599a3b67e090bd | |
parent | c1152b15fe9847693408be853365f2e4d68c073d (diff) |
fix bug pull request files will be broken if head repo was transfered to another user or orgnization (#8571)
-rw-r--r-- | models/repo.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/models/repo.go b/models/repo.go index 36f27fef5..5d17a043b 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1486,6 +1486,13 @@ func TransferOwnership(doer *User, newOwnerName string, repo *Repository) error return fmt.Errorf("update owner: %v", err) } + // Update pull request headusername + if _, err := sess.Where("head_repo_id = ?", repo.ID).Update(&PullRequest{ + HeadUserName: newOwner.LowerName, + }); err != nil { + return fmt.Errorf("update pull request: %v", err) + } + // Remove redundant collaborators. collaborators, err := repo.getCollaborators(sess) if err != nil { |