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" }}
{{ nl2br (index $messageParts 1) }}