Skip to content

Commit eef9030

Browse files
committed
Fix crash for users without profile
1 parent 256bf72 commit eef9030

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

pgcommitfest/commitfest/templates/commitfest.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ <h3>{{p.is_open|yesno:"Active patches,Closed patches"}}</h3>
9595
<td>{{p.reviewer_names|default:''}}</td>
9696
<td>{{p.committer|default:''}}</td>
9797
<td>{{p.num_cfs}}</td>
98-
<td style="white-space: nowrap;" title="{{p.lastmail}}">{%if p.lastmail and user.userprofile.show_relative_timestamps %}{% cfwhen p.lastmail %}{%elif p.lastmail %}{{p.lastmail|date:"Y-m-d"}}<br/>{{p.lastmail|date:"H:i"}}{%endif%}</td>
98+
<td style="white-space: nowrap;" title="{{p.lastmail}}">{%if p.lastmail and userprofile.show_relative_timestamps %}{% cfwhen p.lastmail %}{%elif p.lastmail %}{{p.lastmail|date:"Y-m-d"}}<br/>{{p.lastmail|date:"H:i"}}{%endif%}</td>
9999
{%if user.is_staff%}
100100
<td style="white-space: nowrap;"><input type="checkbox" class="sender_checkbox" id="send_authors_{{p.id}}">Author<br/><input type="checkbox" class="sender_checkbox" id="send_reviewers_{{p.id}}">Reviewer</td>
101101
{%endif%}

pgcommitfest/commitfest/templates/me.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ <h3>{%if user.is_authenticated%}Open patches you are subscribed to{%elif p.is_op
8989
<td>{{p.reviewer_names|default:''}}</td>
9090
<td>{{p.committer|default:''}}</td>
9191
<td>{{p.num_cfs}}</td>
92-
<td style="white-space: nowrap;" title="{{p.lastmail}}">{%if p.lastmail and user.userprofile.show_relative_timestamps %}{% cfwhen p.lastmail %}{%elif p.lastmail %}{{p.lastmail|date:"Y-m-d"}}<br/>{{p.lastmail|date:"H:i"}}{%endif%}</td>
92+
<td style="white-space: nowrap;" title="{{p.lastmail}}">{%if p.lastmail and userprofile.show_relative_timestamps %}{% cfwhen p.lastmail %}{%elif p.lastmail %}{{p.lastmail|date:"Y-m-d"}}<br/>{{p.lastmail|date:"H:i"}}{%endif%}</td>
9393
</tr>
9494
{%if forloop.last%}
9595
</tbody>

pgcommitfest/commitfest/templatetags/commitfest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def hidemail(value):
107107
def cfsince(context, d):
108108
if (
109109
context["user"].is_authenticated
110-
and not context["user"].userprofile.show_relative_timestamps
110+
and not context["userprofile"].show_relative_timestamps
111111
):
112112
return f"since {d}"
113113
partials = cf_duration_partials(d)

pgcommitfest/commitfest/views.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from email.utils import formatdate, make_msgid
2323

2424
from pgcommitfest.mailqueue.util import send_mail, send_simple_mail
25+
from pgcommitfest.userprofile.models import UserProfile
2526
from pgcommitfest.userprofile.util import UserWrapper
2627

2728
from .ajax import _archivesAPI, doAttachThread, refresh_single_thread
@@ -99,6 +100,7 @@ def me(request):
99100
"openpatchids": [p["id"] for p in patch_list.patches if p["is_open"]],
100101
"header_activity": "Activity log",
101102
"header_activity_link": "/activity/",
103+
"userprofile": getattr(request.user, "uesrprofile", UserProfile()),
102104
},
103105
)
104106

@@ -540,6 +542,7 @@ def commitfest(request, cfid):
540542
"openpatchids": [p["id"] for p in patch_list.patches if p["is_open"]],
541543
"header_activity": "Activity log",
542544
"header_activity_link": "activity/",
545+
"userprofile": getattr(request.user, "uesrprofile", UserProfile()),
543546
},
544547
)
545548

@@ -677,6 +680,7 @@ def patch(request, patchid):
677680
"breadcrumbs": [
678681
{"title": cf.title, "href": "/%s/" % cf.pk},
679682
],
683+
"userprofile": getattr(request.user, "uesrprofile", UserProfile()),
680684
},
681685
)
682686

0 commit comments

Comments
 (0)