template: repo: compare: display a warning if the user is not logged in

Signed-off-by: Litchi Pi <litchi.pi@proton.me>
This commit is contained in:
Litchi Pi 2024-12-16 13:44:25 +01:00 committed by litchipi
parent 6836ded397
commit dd4a1107ed
4 changed files with 46 additions and 0 deletions

View file

@ -51,6 +51,7 @@ const (
func setCompareContext(ctx *context.Context, before, head *git.Commit, headOwner, headName string) {
ctx.Data["BeforeCommit"] = before
ctx.Data["HeadCommit"] = head
ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login?redirect_to=" + url.QueryEscape(ctx.Data["Link"].(string))
ctx.Data["GetBlobByPathForCommit"] = func(commit *git.Commit, path string) *git.Blob {
if commit == nil {