Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
andrepapoti committed Nov 4, 2024
1 parent 2a03685 commit 3ec381d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
5 changes: 3 additions & 2 deletions patchwork/templates/patchwork/submission.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{% load humanize %}
{% load syntax %}
{% load person %}
{% load user %}
{% load patch %}
{% load static %}
{% load utils %}
Expand Down Expand Up @@ -194,9 +195,9 @@ <h2>Notes</h2>
<a name="{{ item.id }}"></a>
<div class="submission-message">
<div class="meta">
{{ note.patch.submitter|personify:project }}
User: {{ note.submitter|userfy }},
<span class="message-date">
Last modified: {{ note.last_modified }} UTC
Last modified: {{ note.updated_at }} UTC
</span>
</div>
<pre class="content">
Expand Down
23 changes: 23 additions & 0 deletions patchwork/templatetags/user.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 3ec381d

Please sign in to comment.