diff options
author | 6543 <6543@obermui.de> | 2020-05-05 23:51:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-05 22:51:49 +0100 |
commit | a1f11a05e900f3d1130729b2095dbf1b3037658e (patch) | |
tree | f744bdc675bb34794147c95401d3b2753580b85b | |
parent | d9de58beee300b77156057713e3c4d28176d9dc0 (diff) | |
download | gitea-a1f11a05e900f3d1130729b2095dbf1b3037658e.tar.gz gitea-a1f11a05e900f3d1130729b2095dbf1b3037658e.zip |
Load Repo Topics on blame view (#11307)
Fix #11280
-rw-r--r-- | routers/repo/blame.go | 6 | ||||
-rw-r--r-- | routers/repo/view.go | 19 |
2 files changed, 19 insertions, 6 deletions
diff --git a/routers/repo/blame.go b/routers/repo/blame.go index beed59ea97..00ef9a99ea 100644 --- a/routers/repo/blame.go +++ b/routers/repo/blame.go @@ -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) diff --git a/routers/repo/view.go b/routers/repo/view.go index 5bcf4dae3b..9c9cdc06bf 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -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) |