Skip to content

Commit

Permalink
✨(front) add retention date / duration widgets
Browse files Browse the repository at this point in the history
Add the possibility to add / edit the retention duration or date on:
- playlist through the form (create and update)
- Video / Webinar through a widget
- Classroom through a widget
  • Loading branch information
polyhb committed Jul 5, 2023
1 parent 5874511 commit ac83c31
Show file tree
Hide file tree
Showing 44 changed files with 724 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Versioning](https://semver.org/spec/v2.0.0.html).
object after 21 days.
- Add retention date and s3 lifecycle rules to classroom / video
- Add a command to delete expired classrooms / videos
- Add widget retention date on classroom / video / playlist

### Changed

Expand Down
1 change: 1 addition & 0 deletions src/backend/marsha/bbb/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class Meta: # noqa
"enable_presentation_supports",
"enable_recordings",
"recording_purpose",
"retention_date",
)
read_only_fields = (
"id",
Expand Down
7 changes: 7 additions & 0 deletions src/backend/marsha/bbb/tests/api/classroom/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def test_api_classroom_create_instructor_with_playlist_token(
"public_token": None,
"instructor_token": None,
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down Expand Up @@ -217,6 +218,7 @@ def test_api_classroom_create_user_access_token_organization_admin(
"public_token": classroom.public_token,
"instructor_token": classroom.instructor_token,
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down Expand Up @@ -261,6 +263,7 @@ def test_api_classroom_create_user_access_token_organization_admin(
"public_token": classroom2.public_token,
"instructor_token": classroom2.instructor_token,
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down Expand Up @@ -321,6 +324,7 @@ def test_api_classroom_create_user_access_token_playlist_admin(
"public_token": classroom.public_token,
"instructor_token": classroom.instructor_token,
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down Expand Up @@ -365,6 +369,7 @@ def test_api_classroom_create_user_access_token_playlist_admin(
"public_token": classroom2.public_token,
"instructor_token": classroom2.instructor_token,
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down Expand Up @@ -425,6 +430,7 @@ def test_api_classroom_create_user_access_token_playlist_instructor(
"public_token": classroom.public_token,
"instructor_token": classroom.instructor_token,
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down Expand Up @@ -469,6 +475,7 @@ def test_api_classroom_create_user_access_token_playlist_instructor(
"public_token": classroom2.public_token,
"instructor_token": classroom2.instructor_token,
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down
8 changes: 8 additions & 0 deletions src/backend/marsha/bbb/tests/api/classroom/test_retrieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def test_api_classroom_fetch_student(self, mock_get_meeting_infos):
"public_token": None,
"instructor_token": None,
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down Expand Up @@ -135,6 +136,7 @@ def test_api_classroom_fetch_student_with_recordings(self, mock_get_meeting_info
"starting_at": None,
"estimated_duration": None,
"recordings": [],
"retention_date": None,
"public_token": None,
"instructor_token": None,
"enable_waiting_room": False,
Expand Down Expand Up @@ -209,6 +211,7 @@ def test_api_classroom_fetch_student_scheduled(self, mock_get_meeting_infos):
"public_token": None,
"instructor_token": None,
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down Expand Up @@ -257,6 +260,7 @@ def test_api_classroom_fetch_instructor(self, mock_get_meeting_infos):
"starting_at": None,
"estimated_duration": None,
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down Expand Up @@ -330,6 +334,7 @@ def test_api_classroom_fetch_user_access_token_organization_admin(
"starting_at": None,
"estimated_duration": None,
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down Expand Up @@ -383,6 +388,7 @@ def test_api_classroom_fetch_user_access_token_playlist_admin(
"starting_at": None,
"estimated_duration": None,
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down Expand Up @@ -436,6 +442,7 @@ def test_api_classroom_fetch_user_access_token_playlist_instructor(
"starting_at": None,
"estimated_duration": None,
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down Expand Up @@ -511,6 +518,7 @@ def test_api_classroom_fetch_with_recordings(self, mock_get_meeting_infos):
"vod": None,
},
],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down
2 changes: 2 additions & 0 deletions src/backend/marsha/bbb/tests/api/classroom/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def test_api_classroom_update_instructor_scheduling(self, mock_get_meeting_infos
.replace("+00:00", "Z"),
"estimated_duration": "00:01:00",
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down Expand Up @@ -292,6 +293,7 @@ def test_api_classroom_update_put_instructor_scheduling(
"starting_at": "2018-08-08T01:00:00Z",
"estimated_duration": "00:01:00",
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down
2 changes: 2 additions & 0 deletions src/backend/marsha/bbb/tests/test_views_lti.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ def test_views_lti_classroom_instructor_same_playlist(
"starting_at": None,
"estimated_duration": None,
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down Expand Up @@ -627,6 +628,7 @@ def test_views_lti_classroom_instructor_same_playlist(
"starting_at": None,
"estimated_duration": None,
"recordings": [],
"retention_date": None,
"enable_waiting_room": False,
"enable_chat": True,
"enable_presentation_supports": True,
Expand Down
1 change: 1 addition & 0 deletions src/backend/marsha/core/serializers/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Meta:
"portable_to",
"title",
"users",
"retention_duration",
# Non-model fields
"can_edit",
]
Expand Down
1 change: 1 addition & 0 deletions src/backend/marsha/core/serializers/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ class Meta: # noqa
"participants_in_discussion",
"playlist",
"recording_time",
"retention_date",
"live_info",
"live_state",
"live_type",
Expand Down
2 changes: 2 additions & 0 deletions src/backend/marsha/core/tests/api/playlists/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def test_create_playlist_by_organization_instructor(self):
"name": org.name,
},
"portable_to": [],
"retention_duration": None,
"title": "Some playlist",
"users": [str(user.id)],
},
Expand Down Expand Up @@ -181,6 +182,7 @@ def test_create_playlist_by_organization_administrator(self):
"name": org.name,
},
"portable_to": [],
"retention_duration": None,
"title": "Some playlist",
"users": [str(user.id)],
},
Expand Down
10 changes: 10 additions & 0 deletions src/backend/marsha/core/tests/api/playlists/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def test_list_playlists_by_logged_in_user_with_organization_memberships(self):
"name": org_2.name,
},
"portable_to": [],
"retention_duration": None,
"title": "Second playlist",
"users": [],
"can_edit": True,
Expand All @@ -119,6 +120,7 @@ def test_list_playlists_by_logged_in_user_with_organization_memberships(self):
"name": org_1.name,
},
"portable_to": [],
"retention_duration": None,
"title": "First playlist",
"users": [],
"can_edit": True,
Expand Down Expand Up @@ -193,6 +195,7 @@ def test_list_playlists_for_organization_by_logged_in_user_with_organization_mem
"name": org_1.name,
},
"portable_to": [],
"retention_duration": None,
"title": "First playlist",
"users": [],
"can_edit": True,
Expand Down Expand Up @@ -273,6 +276,7 @@ def test_list_playlist_user_access_administrator_or_instructor(self):
"lti_id": "playlist#five",
"organization": None,
"portable_to": [],
"retention_duration": None,
"title": "Fifth playlist",
"users": [str(user.id)],
"can_edit": True,
Expand All @@ -292,6 +296,7 @@ def test_list_playlist_user_access_administrator_or_instructor(self):
"lti_id": "playlist#four",
"organization": None,
"portable_to": [],
"retention_duration": None,
"title": "Fourth playlist",
"users": [str(user.id)],
"can_edit": True,
Expand All @@ -314,6 +319,7 @@ def test_list_playlist_user_access_administrator_or_instructor(self):
"name": org_2.name,
},
"portable_to": [],
"retention_duration": None,
"title": "Third playlist",
"users": [str(user.id)],
"can_edit": True,
Expand All @@ -336,6 +342,7 @@ def test_list_playlist_user_access_administrator_or_instructor(self):
"name": org_1.name,
},
"portable_to": [],
"retention_duration": None,
"title": "First playlist",
"users": [str(user.id)],
"can_edit": True,
Expand Down Expand Up @@ -452,6 +459,7 @@ def test_list_playlist_ordering_created_on(self):
"name": org_1.name,
},
"portable_to": [],
"retention_duration": None,
"title": "First playlist",
"users": [str(user.id)],
"can_edit": True,
Expand All @@ -474,6 +482,7 @@ def test_list_playlist_ordering_created_on(self):
"name": org_2.name,
},
"portable_to": [],
"retention_duration": None,
"title": "Third playlist",
"users": [str(user.id)],
"can_edit": True,
Expand All @@ -493,6 +502,7 @@ def test_list_playlist_ordering_created_on(self):
"lti_id": "playlist#four",
"organization": None,
"portable_to": [],
"retention_duration": None,
"title": "Fourth playlist",
"users": [str(user.id)],
"can_edit": True,
Expand Down
2 changes: 2 additions & 0 deletions src/backend/marsha/core/tests/api/playlists/test_retrieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def test_retrieve_playlist_by_playlist_admin(self):
"lti_id": playlist.lti_id,
"organization": None,
"portable_to": [],
"retention_duration": None,
"title": playlist.title,
"users": [str(user.id)],
},
Expand Down Expand Up @@ -151,6 +152,7 @@ def test_retrieve_playlist_by_organization_admin(self):
"name": organization.name,
},
"portable_to": [],
"retention_duration": None,
"title": playlist.title,
"users": [],
},
Expand Down
6 changes: 6 additions & 0 deletions src/backend/marsha/core/tests/api/video/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def test_api_video_create_by_playlist_admin(self):
"title": playlist.title,
},
"recording_time": 0,
"retention_date": None,
"shared_live_medias": [],
"should_use_subtitle_as_transcript": False,
"show_download": True,
Expand Down Expand Up @@ -222,6 +223,7 @@ def test_api_video_create_by_playlist_instructor(self):
"title": playlist.title,
},
"recording_time": 0,
"retention_date": None,
"shared_live_medias": [],
"should_use_subtitle_as_transcript": False,
"show_download": True,
Expand Down Expand Up @@ -298,6 +300,7 @@ def test_api_video_create_by_organization_admin(self):
"title": playlist.title,
},
"recording_time": 0,
"retention_date": None,
"shared_live_medias": [],
"should_use_subtitle_as_transcript": False,
"show_download": True,
Expand Down Expand Up @@ -376,6 +379,7 @@ def test_api_video_create_with_scheduled_date_gets_ignored(self):
"title": playlist.title,
},
"recording_time": 0,
"retention_date": None,
"shared_live_medias": [],
"should_use_subtitle_as_transcript": False,
"show_download": True,
Expand Down Expand Up @@ -487,6 +491,7 @@ def test_api_video_create_with_a_valid_upload_state(self):
"title": playlist.title,
},
"recording_time": 0,
"retention_date": None,
"shared_live_medias": [],
"should_use_subtitle_as_transcript": False,
"show_download": True,
Expand Down Expand Up @@ -588,6 +593,7 @@ def test_api_video_create_instructor_with_playlist_token(self):
"title": playlist.title,
},
"recording_time": 0,
"retention_date": None,
"shared_live_medias": [],
"should_use_subtitle_as_transcript": False,
"show_download": True,
Expand Down
2 changes: 2 additions & 0 deletions src/backend/marsha/core/tests/api/video/test_harvest_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ def test_api_video_instructor_harvest_paused_live_recording_slice(self):
"lti_id": video.playlist.lti_id,
},
"recording_time": 600,
"retention_date": None,
"shared_live_medias": [],
"live_state": HARVESTING,
"live_info": {
Expand Down Expand Up @@ -557,6 +558,7 @@ def test_api_video_instructor_harvest_paused_live_missing_manifest(self):
"lti_id": video.playlist.lti_id,
},
"recording_time": 0,
"retention_date": None,
"shared_live_medias": [],
"live_state": STOPPED,
"live_info": {
Expand Down
4 changes: 4 additions & 0 deletions src/backend/marsha/core/tests/api/video/test_initiate_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def test_api_video_instructor_initiate_live(self):
"lti_id": "course-v1:ufr+mathematics+00001",
},
"recording_time": 0,
"retention_date": None,
"shared_live_medias": [],
"live_state": "idle",
"live_info": {},
Expand Down Expand Up @@ -205,6 +206,7 @@ def test_api_video_instructor_initiate_live_with_playlist_token(self):
"lti_id": "course-v1:ufr+mathematics+00001",
},
"recording_time": 0,
"retention_date": None,
"shared_live_medias": [],
"live_state": "idle",
"live_info": {},
Expand Down Expand Up @@ -274,6 +276,7 @@ def test_api_video_instructor_initiate_jitsi_live(self):
"lti_id": "course-v1:ufr+mathematics+00001",
},
"recording_time": 0,
"retention_date": None,
"shared_live_medias": [],
"live_state": "idle",
"live_info": {
Expand Down Expand Up @@ -355,6 +358,7 @@ def test_api_video_instructor_initiate_jitsi_live_with_token(self):
"lti_id": "course-v1:ufr+mathematics+00001",
},
"recording_time": 0,
"retention_date": None,
"shared_live_medias": [],
"live_state": "idle",
"live_info": {
Expand Down
Loading

0 comments on commit ac83c31

Please # to comment.