summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorVladimir Panteleev <CyberShadow@users.noreply.github.com>2019-05-24 10:52:05 +0300
committerLauris BH <lauris@nix.lv>2019-05-24 10:52:05 +0300
commita98e085031bedb53a9776031afde7073af81feaf (patch)
tree3e460d74b7fec8729c8c7422799d485cb7c908ad /routers
parentd5a98a29690e13f717fb72e8635fbea57e58f546 (diff)
downloadgitea-a98e085031bedb53a9776031afde7073af81feaf.tar.gz
gitea-a98e085031bedb53a9776031afde7073af81feaf.zip
Show git-notes (#6984)
* Show git-notes * Make git-notes heading text localizable * Refactor git-notes data fetching to a separate function * Display the author and time of git notes * Move note bubble inside the commit bubble * Revert "Move note bubble inside the commit bubble" This reverts commit c0951fe0e3b4dea38064515546b1825c1bcf19e1. * Add test for git-notes * testing ui * Polish CSS * Apply suggestions from code review Co-Authored-By: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/commit.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index 2978eda6c0..870ff568f3 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -15,6 +15,7 @@ import (
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/templates"
)
const (
@@ -246,6 +247,15 @@ func Diff(ctx *context.Context) {
ctx.Data["Parents"] = parents
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", "commit", commitID)
+
+ note := &git.Note{}
+ err = git.GetNote(ctx.Repo.GitRepo, commitID, note)
+ if err == nil {
+ ctx.Data["Note"] = string(templates.ToUTF8WithFallback(note.Message))
+ ctx.Data["NoteCommit"] = note.Commit
+ ctx.Data["NoteAuthor"] = models.ValidateCommitWithEmail(note.Commit)
+ }
+
if commit.ParentCount() > 0 {
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", "commit", parents[0])
}