Skip to content

Commit 08500ec

Browse files
committed
Summary: Don't show edit buttons on snapshots of previous document revisions
- Legacy-Id: 10121
1 parent b1fee9c commit 08500ec

2 files changed

Lines changed: 31 additions & 29 deletions

File tree

ietf/doc/views_doc.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,32 +307,32 @@ def document_main(request, name, rev=None):
307307
# remaining actions
308308
actions = []
309309

310-
if can_adopt_draft(request.user, doc) and not doc.get_state_slug() in ["rfc"]:
310+
if can_adopt_draft(request.user, doc) and not doc.get_state_slug() in ["rfc"] and not snapshot:
311311
actions.append(("Manage Document Adoption in Group", urlreverse('doc_adopt_draft', kwargs=dict(name=doc.name))))
312312

313-
if doc.get_state_slug() == "expired" and not resurrected_by and can_edit:
313+
if doc.get_state_slug() == "expired" and not resurrected_by and can_edit and not snapshot:
314314
actions.append(("Request Resurrect", urlreverse('doc_request_resurrect', kwargs=dict(name=doc.name))))
315315

316-
if doc.get_state_slug() == "expired" and has_role(request.user, ("Secretariat",)):
316+
if doc.get_state_slug() == "expired" and has_role(request.user, ("Secretariat",)) and not snapshot:
317317
actions.append(("Resurrect", urlreverse('doc_resurrect', kwargs=dict(name=doc.name))))
318318

319319
if (doc.get_state_slug() not in ["rfc", "expired"] and doc.stream_id in ("ise", "irtf")
320-
and can_edit_stream_info and not conflict_reviews):
320+
and can_edit_stream_info and not conflict_reviews and not snapshot):
321321
label = "Begin IETF Conflict Review"
322322
if not doc.intended_std_level:
323323
label += " (note that intended status is not set)"
324324
actions.append((label, urlreverse('conflict_review_start', kwargs=dict(name=doc.name))))
325325

326326
if (doc.get_state_slug() not in ["rfc", "expired"] and doc.stream_id in ("iab", "ise", "irtf")
327-
and can_edit_stream_info):
327+
and can_edit_stream_info and not snapshot):
328328
label = "Request Publication"
329329
if not doc.intended_std_level:
330330
label += " (note that intended status is not set)"
331331
if iesg_state and iesg_state.slug != 'dead':
332332
label += " (Warning: the IESG state indicates ongoing IESG processing)"
333333
actions.append((label, urlreverse('doc_request_publication', kwargs=dict(name=doc.name))))
334334

335-
if doc.get_state_slug() not in ["rfc", "expired"] and doc.stream_id in ("ietf",):
335+
if doc.get_state_slug() not in ["rfc", "expired"] and doc.stream_id in ("ietf",) and not snapshot:
336336
if not iesg_state and can_edit:
337337
actions.append(("Begin IESG Processing", urlreverse('doc_edit_info', kwargs=dict(name=doc.name)) + "?new=1"))
338338
elif can_edit_stream_info and (not iesg_state or iesg_state.slug == 'watching'):

ietf/templates/doc/document_draft.html

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<th></th>
8181
<th>Replaces</th>
8282
<td class="edit">
83-
{% if can_edit_stream_info %}
83+
{% if can_edit_stream_info and not snapshot %}
8484
<a class="btn btn-default btn-xs" href="{% url "doc_change_replaces" name=doc.name %}">Edit</a>
8585
{% endif %}
8686
</td>
@@ -106,7 +106,7 @@
106106
<tr>
107107
<th>Possibly Replaces</th>
108108
<td class="edit">
109-
{% if can_edit_replaces %}
109+
{% if can_edit_replaces and not snapshot %}
110110
<a class="btn btn-default btn-xs" href="{% url "doc_review_possibly_replaces" name=doc.name %}">Edit</a>
111111
{% endif %}
112112
</td>
@@ -120,7 +120,7 @@
120120
<tr>
121121
<th>Possibly Replaced By</th>
122122
<td class="edit">
123-
{% if can_edit_replaces %}
123+
{% if can_edit_replaces and not snapshot %}
124124
{% comment %}<a class="btn btn-default btn-xs" href="{% url "doc_review_possibly_replaces" name=doc.name %}">Edit</a>{% endcomment %}
125125
{% endif %}
126126
</td>
@@ -135,7 +135,7 @@
135135
<th></th>
136136
<th>Stream</th>
137137
<td class="edit">
138-
{% if can_change_stream %}
138+
{% if can_change_stream and not snapshot %}
139139
<a class="btn btn-default btn-xs" href="{% url "doc_change_stream" name=doc.name %}">Edit</a>
140140
{% endif %}
141141
</td>
@@ -149,8 +149,8 @@
149149
<th></th>
150150
<th>Intended RFC status</th>
151151
<td class="edit">
152-
{% if can_edit or can_edit_stream_info %}
153-
<a class="btn btn-default btn-xs" href="{% url "doc_change_intended_status" name=doc.name %}">Edit</a>
152+
{% if can_edit_stream_info and not snapshot %}
153+
<a class="btn btn-default btn-xs" href="{% url "doc_change_intended_status" name=doc.name %}">Edit</a>
154154
{% endif %}
155155
</td>
156156
<td>
@@ -201,7 +201,7 @@
201201
{% endif %}
202202
</th>
203203
<td class="edit">
204-
{% if doc.stream and can_edit_stream_info %}
204+
{% if doc.stream and can_edit_stream_info and doc.stream.slug != "legacy" and not snapshot %}
205205
<a class="btn btn-default btn-xs" href="{% url "doc_change_stream_state" name=doc.name state_type=stream_state_type_slug %}">Edit</a>
206206
{% endif %}
207207
</td>
@@ -228,7 +228,7 @@
228228
<th></th>
229229
<th>Consensus</th>
230230
<td class="edit">
231-
{% if can_edit or can_edit_stream_info %}
231+
{% if can_edit_stream_info and not snapshot %}
232232
<a class="btn btn-default btn-xs" href="{% url "doc_edit_consensus" name=doc.name %}">Edit</a>
233233
{% endif %}
234234
</td>
@@ -241,13 +241,15 @@
241241
<tr>
242242
<th></th>
243243
<th>Document shepherd</th>
244-
<td class="edit">
245-
{% if can_edit_stream_info %}
246-
<a class="btn btn-default btn-xs" href="{% url "doc_edit_shepherd" name=doc.name %}">Edit</a>
247-
{% elif is_shepherd %}
248-
<a class="btn btn-default btn-xs" href="{% url "doc_change_shepherd_email" name=doc.name %}">Change Email</a>
249-
{% endif %}
250-
</td>
244+
<td class="edit">
245+
{% if not snapshot %}
246+
{% if can_edit_stream_info %}
247+
<a class="btn btn-default btn-xs" href="{% url "doc_edit_shepherd" name=doc.name %}">Edit</a>
248+
{% elif is_shepherd %}
249+
<a class="btn btn-default btn-xs" href="{% url "doc_change_shepherd_email" name=doc.name %}">Change Email</a>
250+
{% endif %}
251+
{% endif %}
252+
</td>
251253
<td>
252254
{% if doc.shepherd %}{{ doc.shepherd.person }}{% else %}No shepherd assigned{% endif %}
253255
</td>
@@ -258,7 +260,7 @@
258260
<th></th>
259261
<th>Shepherd write-up</th>
260262
<td class="edit">
261-
{% if can_edit_shepherd_writeup %}
263+
{% if can_edit_shepherd_writeup and not snapshot %}
262264
{% url "doc_edit_shepherd_writeup" name=doc.name as doc_edit_url %}
263265
{% if doc_edit_url %}
264266
<a class="btn btn-default btn-xs" href="{{doc_edit_url}}">Edit</a>
@@ -289,7 +291,7 @@
289291
<th>IESG</th>
290292
<th><a href="{% url "ietf.help.views.state" doc=doc.type.slug type="iesg" %}">IESG state</a></th>
291293
<td class="edit">
292-
{% if iesg_state and can_edit %}
294+
{% if iesg_state and can_edit and not snapshot %}
293295
<a class="btn btn-default btn-xs" href="{% url "doc_change_state" name=doc.name %}">Edit</a>
294296
{% endif %}
295297
</td>
@@ -302,7 +304,7 @@
302304
<th></th>
303305
<th>Telechat date</th>
304306
<td class="edit">
305-
{% if can_edit %}
307+
{% if can_edit and not snapshot %}
306308
<a class="btn btn-default btn-xs" href="{% url "doc_change_telechat_date" name=doc.name %}">Edit</a>
307309
{% endif %}
308310
</td>
@@ -328,7 +330,7 @@
328330
<th></th>
329331
<th>Responsible AD</th>
330332
<td class="edit">
331-
{% if can_edit %}
333+
{% if can_edit and not snapshot %}
332334
<a class="btn btn-default btn-xs" href="{% url "doc_change_ad" name=doc.name %}">Edit</a>
333335
{% endif %}
334336
</td>
@@ -343,7 +345,7 @@
343345
<th></th>
344346
<th>IESG note</th>
345347
<td class="edit">
346-
{% if can_edit %}
348+
{% if can_edit and not snapshot %}
347349
<a class="btn btn-default btn-xs" href="{% url "doc_change_iesg_note" name=doc.name %}">Edit</a>
348350
{% endif %}
349351
</td>
@@ -358,7 +360,7 @@
358360
<th></th>
359361
<th>Send notices to</th>
360362
<td class="edit">
361-
{% if can_edit_notify %}
363+
{% if can_edit_notify and not snapshot %}
362364
<a class="btn btn-default btn-xs" href="{% url "doc_change_notify" name=doc.name %}">Edit</a>
363365
{% endif %}
364366
</td>
@@ -375,7 +377,7 @@
375377
<th>IANA</th>
376378
<th><a href="{% url "ietf.help.views.state" doc=doc.type.slug type="iana-review" %}">IANA review state</a></th>
377379
<td class="edit">
378-
{% if can_edit_iana_state %}
380+
{% if can_edit_iana_state and not snapshot %}
379381
<a class="btn btn-default btn-xs" href="{% url "doc_change_iana_state" name=doc.name state_type="iana-review" %}">Edit</a>
380382
{% endif %}
381383
</td>
@@ -388,7 +390,7 @@
388390
<th></th>
389391
<th>IANA action state</th>
390392
<td class="edit">
391-
{% if can_edit_iana_state %}
393+
{% if can_edit_iana_state and not snapshot %}
392394
<a class="btn btn-default btn-xs" href="{% url "doc_change_iana_state" name=doc.name state_type="iana-action" %}">Edit</a>
393395
{% endif %}
394396
</td>

0 commit comments

Comments
 (0)