diff --git a/pagure/templates/commit.html b/pagure/templates/commit.html
index 5dbf249..70365e5 100644
--- a/pagure/templates/commit.html
+++ b/pagure/templates/commit.html
@@ -37,14 +37,14 @@
Author |
- {{ commit.author.name }} {{ '<' + commit.author.email + '>' }}
+ {{ commit.author | author2user |safe }}
- {{ commit.commit_time | format_ts}}
|
Committer |
- {{ commit.committer.name }} {{ '<' + commit.committer.email + '>' }}
+ {{ commit.committer | author2user |safe }}
- {{ commit.commit_time | format_ts }}
|
diff --git a/pagure/ui/filters.py b/pagure/ui/filters.py
index 137c7be..bc7b930 100644
--- a/pagure/ui/filters.py
+++ b/pagure/ui/filters.py
@@ -234,3 +234,19 @@ def patch_to_diff(patch):
for line in hunk.lines:
content = content + ' '.join(line)
return content
+
+
+@APP.template_filter('author2user')
+def author_to_user(author, size=16):
+ """ Template filter transforming a pygit2 Author object into a text
+ either with just the username or linking to the user in pagure.
+ """
+ user = pagure.lib.search_user(SESSION, email=author.email)
+ output = author.name
+ if user:
+ output = "%s %s" % (
+ avatar(user.user, size),
+ flask.url_for('view_user', username=user.username),
+ author.name,
+ )
+ return output