From 3e61a9628c4d8866207b6e9fe620bad7e08d30d4 Mon Sep 17 00:00:00 2001 From: John Olheiser <42128690+jolheiser@users.noreply.github.com> Date: Wed, 23 Oct 2019 12:54:13 -0500 Subject: [PATCH] Improve OGP (#8637) * Improve OGP * Ensure Repo is loaded when checking Pull info Signed-off-by: jolheiser --- routers/repo/pull.go | 4 ++++ templates/base/head.tmpl | 24 +++++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/routers/repo/pull.go b/routers/repo/pull.go index 4001e3a4f80e7..4b73571e66352 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -242,6 +242,10 @@ func checkPullInfo(ctx *context.Context) *models.Issue { ctx.ServerError("LoadPoster", err) return nil } + if err := issue.LoadRepo(); err != nil { + ctx.ServerError("LoadRepo", err) + return nil + } ctx.Data["Title"] = fmt.Sprintf("#%d - %s", issue.Index, issue.Title) ctx.Data["Issue"] = issue diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index ae2b6b954d601..c0686ca93e085 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -131,16 +131,25 @@ - + {{if .Owner.Description}} + + {{end}} {{else if .Repository}} - + {{if .Issue}} + + + {{if .Issue.Content}} + + {{end}} + {{else}} + + + {{if .Repository.Description}} + + {{end}} + {{end}} - - {{if .Repository.Description}} - - {{end}} - {{else}} @@ -148,6 +157,7 @@ {{end}} + {{if .IsSigned }} {{ if ne .SignedUser.Theme "gitea" }}