Some repository refactors (#17950)

* some repository refactors

* remove unnecessary code

* Fix test

* Remove unnecessary banner
This commit is contained in:
Lunny Xiao 2021-12-12 23:48:20 +08:00 committed by GitHub
parent 0a7e8327a0
commit 5723240490
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
88 changed files with 1363 additions and 1388 deletions

View file

@ -340,7 +340,7 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo {
// "OwnForkRepo"
var ownForkRepo *repo_model.Repository
if ctx.User != nil && baseRepo.OwnerID != ctx.User.ID {
repo := models.GetForkedRepo(ctx.User.ID, baseRepo.ID)
repo := repo_model.GetForkedRepo(ctx.User.ID, baseRepo.ID)
if repo != nil {
ownForkRepo = repo
ctx.Data["OwnForkRepo"] = ownForkRepo
@ -364,13 +364,13 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo {
// 5. If the headOwner has a fork of the baseRepo - use that
if !has {
ci.HeadRepo = models.GetForkedRepo(ci.HeadUser.ID, baseRepo.ID)
ci.HeadRepo = repo_model.GetForkedRepo(ci.HeadUser.ID, baseRepo.ID)
has = ci.HeadRepo != nil
}
// 6. If the baseRepo is a fork and the headUser has a fork of that use that
if !has && baseRepo.IsFork {
ci.HeadRepo = models.GetForkedRepo(ci.HeadUser.ID, baseRepo.ForkID)
ci.HeadRepo = repo_model.GetForkedRepo(ci.HeadUser.ID, baseRepo.ForkID)
has = ci.HeadRepo != nil
}