Skip to content

Commit

Permalink
fix bug pull request files will be broken if head repo was transfered…
Browse files Browse the repository at this point in the history
… to another user or orgnization (#8571)
  • Loading branch information
lunny authored Oct 18, 2019
1 parent c1152b1 commit d4501ec
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions models/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit d4501ec

Please sign in to comment.