Skip to content

Commit 9cc15d1

Browse files
authored
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 <[email protected]>
1 parent 519b91a commit 9cc15d1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

models/project/project.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ func (p *Project) Link() string {
123123
log.Error("LoadOwner: %v", err)
124124
return ""
125125
}
126-
return fmt.Sprintf("/%s/-/projects/%d", p.Owner.Name, p.ID)
126+
return fmt.Sprintf("%s/-/projects/%d", p.Owner.HomeLink(), p.ID)
127127
}
128128
if p.RepoID > 0 {
129129
err := p.LoadRepo(db.DefaultContext)
130130
if err != nil {
131131
log.Error("LoadRepo: %v", err)
132132
return ""
133133
}
134-
return fmt.Sprintf("/%s/projects/%d", p.Repo.RepoPath(), p.ID)
134+
return fmt.Sprintf("%s/projects/%d", p.Repo.Link(), p.ID)
135135
}
136136
return ""
137137
}

0 commit comments

Comments
 (0)