From fc903a0e4abdc6beef93d7ce9be335dd9d06cf76 Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Mon, 8 Dec 2025 06:53:01 +0000 Subject: [PATCH] appview/pages: show co-authors and committers in commit messages Change-Id: nxmrsnottttlsktwwpqtqsqntmzunyqz in smaller views of a commit, such as logs, only the profile pictures of coauthors are shown, and the lead author's identity is suffixed with a "+ N" to indicate co-authors. in larger views of a commit, such as the commit view, the authors and the committer are explicitly laid out, DIDs are resolved where possible and shown alongside profile pictures. Signed-off-by: oppiliappan --- appview/pages/funcmap.go | 2 +- appview/pages/templates/repo/commit.html | 43 ++++++++++++---- appview/pages/templates/repo/index.html | 38 +++++++++++--- appview/pages/templates/repo/log.html | 63 +++++++++++++++--------- appview/repo/repo_util.go | 20 ++++---- types/commit.go | 2 +- 6 files changed, 116 insertions(+), 52 deletions(-) diff --git a/appview/pages/funcmap.go b/appview/pages/funcmap.go index 0f424d61..ec123657 100644 --- a/appview/pages/funcmap.go +++ b/appview/pages/funcmap.go @@ -162,7 +162,7 @@ func (p *Pages) funcMap() template.FuncMap { } return pairs, nil }, - "append": func(s []string, values ...string) []string { + "append": func(s []any, values ...any) []any { s = append(s, values...) return s }, diff --git a/appview/pages/templates/repo/commit.html b/appview/pages/templates/repo/commit.html index d1a2e5f3..0fe7d92a 100644 --- a/appview/pages/templates/repo/commit.html +++ b/appview/pages/templates/repo/commit.html @@ -25,17 +25,11 @@
-

- {{ $did := index $.EmailToDid $commit.Author.Email }} - - {{ if $did }} - {{ template "user/fragments/picHandleLink" $did }} - {{ else }} - {{ $commit.Author.Name }} - {{ end }} +

+ {{ template "attribution" . }} - {{ template "repo/fragments/time" $commit.Committer.When }} + {{ template "repo/fragments/time" $commit.Committer.When }} {{ slice $commit.This 0 8 }} @@ -79,6 +73,37 @@ {{end}} +{{ define "attribution" }} + {{ $commit := .Diff.Commit }} + {{ $showCommitter := true }} + {{ if eq $commit.Author.Email $commit.Committer.Email }} + {{ $showCommitter = false }} + {{ end }} + + {{ if $showCommitter }} + authored by {{ template "attributedUser" (list $commit.Author.Email $commit.Author.Name $.EmailToDid) }} + {{ range $commit.CoAuthors }} + {{ template "attributedUser" (list .Email .Name $.EmailToDid) }} + {{ end }} + and committed by {{ template "attributedUser" (list $commit.Committer.Email $commit.Committer.Name $.EmailToDid) }} + {{ else }} + {{ template "attributedUser" (list $commit.Author.Email $commit.Author.Name $.EmailToDid )}} + {{ end }} +{{ end }} + +{{ define "attributedUser" }} + {{ $email := index . 0 }} + {{ $name := index . 1 }} + {{ $map := index . 2 }} + {{ $did := index $map $email }} + + {{ if $did }} + {{ template "user/fragments/picHandleLink" $did }} + {{ else }} + {{ $name }} + {{ end }} +{{ end }} + {{ define "topbarLayout" }}

{{ template "layouts/fragments/topbar" . }} diff --git a/appview/pages/templates/repo/index.html b/appview/pages/templates/repo/index.html index 372a565d..5cd8d499 100644 --- a/appview/pages/templates/repo/index.html +++ b/appview/pages/templates/repo/index.html @@ -14,7 +14,7 @@ {{ end }}
{{ block "branchSelector" . }}{{ end }} -
+
{{ i "git-commit-horizontal" "w-4" "h-4" }} {{ .TotalCommits }} @@ -66,7 +66,7 @@ {{ define "branchSelector" }}
-
+