Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load Repo Topics on blame view too #11307

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix 11280
  • Loading branch information
6543 committed May 5, 2020
commit d38e2f52263b797d1df972fbf56ad3ae62e9dae5
6 changes: 6 additions & 0 deletions routers/repo/blame.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 13 additions & 6 deletions routers/repo/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down