🐛(backend) update media auth endpoint to check correct recording status

Modify media auth endpoint to properly handle recordings with "Notification
succeeded" status alongside "Saved" status. Previous code incorrectly
expected only "Saved" status, causing access issues after email notifications
were sent and status was updated.
This commit is contained in:
lebaudantoine
2025-04-18 10:44:48 +02:00
committed by aleb_the_flash
parent 4afbd9ba7f
commit 886919c23d
2 changed files with 8 additions and 2 deletions

View File

@@ -581,7 +581,10 @@ class Recording(BaseModel):
@property
def is_saved(self) -> bool:
"""Check if the recording is in a saved state."""
return self.status == RecordingStatusChoices.SAVED
return self.status in {
RecordingStatusChoices.NOTIFICATION_SUCCEEDED,
RecordingStatusChoices.SAVED,
}
@property
def extension(self):

View File

@@ -256,10 +256,13 @@ def test_models_recording_key_for_unknown_mode(settings):
def test_models_recording_is_saved_true():
"""Test is_saved property returns True for SAVED status."""
"""Test is_saved property returns True for SAVED and NOTIFICATION_SUCCEEDED status."""
recording = RecordingFactory(status=RecordingStatusChoices.SAVED)
assert recording.is_saved is True
recording = RecordingFactory(status=RecordingStatusChoices.NOTIFICATION_SUCCEEDED)
assert recording.is_saved is True
def test_models_recording_is_saved_false_active():
"""Test is_saved property returns False for ACTIVE status."""