Skip to content

Commit cd09bf1

Browse files
committed
fix: soft-delete된 발표자는 노출 안 되도록 수정
1 parent 8d046c4 commit cd09bf1

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎app/participant_portal_api/serializers/presentation.py‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,22 @@ def get_speaker_instance(self, speaker_id: str | uuid.UUID) -> PresentationSpeak
7474
.first()
7575
)
7676

77+
def get_active_speaker_ids(self, instance) -> set[str] | None:
78+
if (active_speakers := getattr(instance, "active_speakers", None)) is None:
79+
return None
80+
return {str(speaker.id) for speaker in active_speakers}
81+
7782
def to_representation(self, instance):
7883
result = super().to_representation(instance)
7984

8085
if (current_user := get_current_user()) and (speakers := result.get("speakers")):
81-
result["speakers"] = [s for s in speakers if s["user"]["id"] == current_user.pk]
86+
active_speaker_ids = self.get_active_speaker_ids(instance)
87+
result["speakers"] = [
88+
s
89+
for s in speakers
90+
if s["user"]["id"] == current_user.pk
91+
and (active_speaker_ids is None or str(s["id"]) in active_speaker_ids)
92+
]
8293
else:
8394
result["speakers"] = []
8495

0 commit comments

Comments
 (0)