Skip to content

Commit 7d321be

Browse files
committed
views: Add notes to patch-detail view
The submission template now includes a section to display notes, these can be filtered out depending if the request user is a maintainer for the patch's project and on the note maintainer_only attribute Signed-off-by: andrepapoti <[email protected]>
1 parent 7936f3a commit 7d321be

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

patchwork/templates/patchwork/submission.html

+18
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,24 @@ <h2>Message</h2>
266266
</pre>
267267
</div>
268268

269+
{% for note in notes %}
270+
{% if forloop.first %}
271+
<h2>Notes</h2>
272+
{% endif %}
273+
<a name="{{ item.id }}"></a>
274+
<div class="submission-message">
275+
<div class="meta">
276+
{{ note.submitter|personify:project }}
277+
<span class="message-date">
278+
Last modified: {{ note.last_modified }} UTC
279+
</span>
280+
</div>
281+
<pre class="content">
282+
{{ note.content }}
283+
</pre>
284+
</div>
285+
{% endfor %}
286+
269287
{% for item in comments %}
270288
{% if forloop.first %}
271289
<h2>Comments</h2>

patchwork/views/patch.py

+9
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,14 @@ def patch_detail(request, project_id, msgid):
122122
'submitter', 'date', 'id', 'content', 'patch', 'addressed'
123123
)
124124

125+
if (
126+
request.user.is_authenticated
127+
and patch.project not in request.user.profile.maintainer_projects.all()
128+
):
129+
notes = patch.note.all()
130+
else:
131+
notes = patch.note.filter(maintainer_only=False)
132+
125133
if patch.related:
126134
related_same_project = patch.related.patches.only(
127135
'name', 'msgid', 'project', 'related'
@@ -136,6 +144,7 @@ def patch_detail(request, project_id, msgid):
136144
related_same_project = []
137145
related_different_project = []
138146

147+
context['notes'] = notes
139148
context['comments'] = comments
140149
context['checks'] = Patch.filter_unique_checks(
141150
patch.check_set.all().select_related('user'),

0 commit comments

Comments
 (0)