Browse Source

Load Repo Topics on blame view (#11307)

Fix #11280
for-closed-social
6543 4 years ago
committed by GitHub
parent
commit
a1f11a05e9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 6 deletions
  1. +6
    -0
      routers/repo/blame.go
  2. +13
    -6
      routers/repo/view.go

+ 6
- 0
routers/repo/blame.go View File

@ -194,6 +194,12 @@ func RefBlame(ctx *context.Context) {
commitNames[c.ID.String()] = c
}
// Get Topics of this repo
renderRepoTopics(ctx)
if ctx.Written() {
return
}
renderBlame(ctx, blameParts, commitNames)
ctx.HTML(200, tplBlame)

+ 13
- 6
routers/repo/view.go View File

@ -621,6 +621,17 @@ func renderLanguageStats(ctx *context.Context) {
ctx.Data["LanguageStats"] = langs
}
func renderRepoTopics(ctx *context.Context) {
topics, err := models.FindTopics(&models.FindTopicOptions{
RepoID: ctx.Repo.Repository.ID,
})
if err != nil {
ctx.ServerError("models.FindTopics", err)
return
}
ctx.Data["Topics"] = topics
}
func renderCode(ctx *context.Context) {
ctx.Data["PageIsViewCode"] = true
@ -645,14 +656,10 @@ func renderCode(ctx *context.Context) {
}
// Get Topics of this repo
topics, err := models.FindTopics(&models.FindTopicOptions{
RepoID: ctx.Repo.Repository.ID,
})
if err != nil {
ctx.ServerError("models.FindTopics", err)
renderRepoTopics(ctx)
if ctx.Written() {
return
}
ctx.Data["Topics"] = topics
// Get current entry user currently looking at.
entry, err := ctx.Repo.Commit.GetTreeEntryByPath(ctx.Repo.TreePath)

Loading…
Cancel
Save