[PATCH 36/51] series: Only show the edit icon when the series is editable

Damien Lespiau damien.lespiau at intel.com
Sat Sep 12 01:55:09 AEST 2015


While the permissions are enforced at the API level, people will be
upset if allow them to see the edition widget but deny the edit when
saving the new field.

So let's not show any edit icon when we're not allowed to edit an
object.

Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
 patchwork/templates/patchwork/series.html | 2 ++
 patchwork/views/series.py                 | 1 +
 2 files changed, 3 insertions(+)

diff --git a/patchwork/templates/patchwork/series.html b/patchwork/templates/patchwork/series.html
index 3826647..0691354 100644
--- a/patchwork/templates/patchwork/series.html
+++ b/patchwork/templates/patchwork/series.html
@@ -55,7 +55,9 @@ $(function () {
         <em class="text-muted">None</em>
 {% endif %}
         </span>
+{% if is_editable %}
         <span class="glyphicon glyphicon-pencil" ></span>
+{% endif %}
       </span>
       <div id="edit-reviewer" class="form-inline" style="display:none;">
         <div class="form-group">
diff --git a/patchwork/views/series.py b/patchwork/views/series.py
index 785c3a9..27c6aab 100644
--- a/patchwork/views/series.py
+++ b/patchwork/views/series.py
@@ -37,6 +37,7 @@ class SeriesView(View):
         return render(request, 'patchwork/series.html', {
             'series': series,
             'project': series.project,
+            'is_editable': series.project.is_editable(request.user),
             'cover_letter': revision.cover_letter,
             'patches': revision.patches.all(),
         })
-- 
2.1.0



More information about the Patchwork mailing list