Skip to content

Commit

Permalink
Project links should use parent link methods (#22587)
Browse files Browse the repository at this point in the history
Instead of re-creating, these should use the available `Link` methods
from the "parent" of the project, which also take sub-urls into account.

Signed-off-by: jolheiser <john.olheiser@gmail.com>
  • Loading branch information
jolheiser authored Jan 23, 2023
1 parent 519b91a commit 9cc15d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ func (p *Project) Link() string {
log.Error("LoadOwner: %v", err)
return ""
}
return fmt.Sprintf("/%s/-/projects/%d", p.Owner.Name, p.ID)
return fmt.Sprintf("%s/-/projects/%d", p.Owner.HomeLink(), p.ID)
}
if p.RepoID > 0 {
err := p.LoadRepo(db.DefaultContext)
if err != nil {
log.Error("LoadRepo: %v", err)
return ""
}
return fmt.Sprintf("/%s/projects/%d", p.Repo.RepoPath(), p.ID)
return fmt.Sprintf("%s/projects/%d", p.Repo.Link(), p.ID)
}
return ""
}
Expand Down

0 comments on commit 9cc15d1

Please sign in to comment.