fix: prevent slide upload by participants after session (#10582) - #11258
Conversation
|
I found another "Upload slides" button that isn't covered by this fix yet (materials/views.py line 1937). Will add. |
jennifer-richards
left a comment
There was a problem hiding this comment.
Style nit + a question
| Upload new slides | ||
| </a> | ||
| {% elif request.user.is_authenticated and not session.is_material_submission_cutoff %} | ||
| {% elif request.user.is_authenticated and not session.is_past %} |
There was a problem hiding this comment.
Should this be ...and not session.is_past and not session.is_material_submission_cutoff? I.e., is this going to undesirably start allowing submissions between the material submission cutoff and the end of the session?
There was a problem hiding this comment.
It was my understanding that the material submission cutoff was after the meeting, to lock down the content for proceedings and such. This was partly based on what I saw in the test cases. So is_past would be a tighter restriction. If my understanding was incorrect, this would need to change.
There was a problem hiding this comment.
Ah, you're likely right - I was thinking of draft submission deadline.
Co-authored-by: Jennifer Richards <jennifer@staff.ietf.org>
jennifer-richards
left a comment
There was a problem hiding this comment.
Fixed the failing tests, added missing test coverage, and adjusted to handle a corner case.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11258 +/- ##
==========================================
+ Coverage 88.58% 88.62% +0.04%
==========================================
Files 333 333
Lines 44728 44815 +87
==========================================
+ Hits 39624 39719 +95
+ Misses 5104 5096 -8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Restricts slide submission by other than those that can manage slides after the session has ended.
Does not include tests for this, and breaks two existing tests:
======================================================================
FAIL: test_propose_session_slides (ietf.meeting.tests_views.MaterialsTests.test_propose_session_slides)
Traceback (most recent call last):
File "/workspace/ietf/meeting/tests_views.py", line 7077, in test_propose_session_slides
self.assertTrue(q('.proposeslides'))
AssertionError: [] is not true
======================================================================
FAIL: test_submit_and_approve_multiple_versions (ietf.meeting.tests_views.MaterialsTests.test_submit_and_approve_multiple_versions)
Traceback (most recent call last):
File "/home/dev/.local/lib/python3.12/site-packages/django/test/utils.py", line 461, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/unittest/mock.py", line 1396, in patched
return func(*newargs, **newkeywargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/ietf/meeting/tests_views.py", line 7271, in test_submit_and_approve_multiple_versions
self.assertEqual(r.status_code, 302)
AssertionError: 403 != 302
Apparently this was because the sessions created for testing did not specify a time. I'm surprised this didn't fail before, because the submission would probably have violated the grace time after which Secretariat action is needed. I tried but didn't manage to succeed in fixing these test cases by adding a session time to the SessionFactory calls.