diff --git a/patchwork/templates/patchwork/submission.html b/patchwork/templates/patchwork/submission.html index 72ce2345..7fd23c47 100644 --- a/patchwork/templates/patchwork/submission.html +++ b/patchwork/templates/patchwork/submission.html @@ -3,6 +3,7 @@ {% load humanize %} {% load syntax %} {% load person %} +{% load user %} {% load patch %} {% load static %} {% load utils %} @@ -194,9 +195,9 @@

Notes

- {{ note.patch.submitter|personify:project }} + User: {{ note.submitter|userfy }}, - Last modified: {{ note.last_modified }} UTC + Last modified: {{ note.updated_at }} UTC
diff --git a/patchwork/templatetags/user.py b/patchwork/templatetags/user.py
new file mode 100644
index 00000000..40c93367
--- /dev/null
+++ b/patchwork/templatetags/user.py
@@ -0,0 +1,23 @@
+# Patchwork - automated patch tracking system
+# Copyright (C) 2024 Meta Platforms, Inc. and affiliates.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from django import template
+from django.utils.html import escape
+from django.utils.safestring import mark_safe
+
+
+register = template.Library()
+
+
+@register.filter
+def userfy(user):
+    if user.first_name and user.last_name:
+        linktext = escape(f'{user.first_name} {user.last_name}')
+    elif user.email:
+        linktext = escape(user.email)
+    else:
+        linktext = escape(user.username)
+
+    return mark_safe(linktext)