aboutsummaryrefslogtreecommitdiffstats
path: root/models/project
diff options
context:
space:
mode:
authorJohn Olheiser <john.olheiser@gmail.com>2023-01-23 15:51:18 -0600
committerGitHub <noreply@github.com>2023-01-23 15:51:18 -0600
commit9cc15d18dfe25f5e0a7569ffb6203e9a4dbb2404 (patch)
treed3f113774feba0f11a253da967378c1481326ad7 /models/project
parent519b91ad2da231c26890ee601ad1d089d26bf351 (diff)
downloadgitea-9cc15d18dfe25f5e0a7569ffb6203e9a4dbb2404.tar.gz
gitea-9cc15d18dfe25f5e0a7569ffb6203e9a4dbb2404.zip
Project links should use parent link methods (#22587)
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>
Diffstat (limited to 'models/project')
-rw-r--r--models/project/project.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/models/project/project.go b/models/project/project.go
index 8bac9115ba..273823ac9d 100644
--- a/models/project/project.go
+++ b/models/project/project.go
@@ -123,7 +123,7 @@ 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)
@@ -131,7 +131,7 @@ func (p *Project) Link() string {
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 ""
}