fix: send email on transcript page permissions fixed

This commit is contained in:
Juan
2026-03-26 11:17:11 -05:00
parent bfaf4f403b
commit 8c9435d8ca
2 changed files with 4 additions and 11 deletions

View File

@@ -700,8 +700,6 @@ async def transcript_post_to_zulip(
) )
if not transcript: if not transcript:
raise HTTPException(status_code=404, detail="Transcript not found") raise HTTPException(status_code=404, detail="Transcript not found")
if not transcripts_controller.user_can_mutate(transcript, user_id):
raise HTTPException(status_code=403, detail="Not authorized")
content = get_zulip_message(transcript, include_topics) content = get_zulip_message(transcript, include_topics)
message_updated = False message_updated = False
@@ -733,17 +731,15 @@ class SendEmailResponse(BaseModel):
async def transcript_send_email( async def transcript_send_email(
transcript_id: str, transcript_id: str,
request: SendEmailRequest, request: SendEmailRequest,
user: Annotated[auth.UserInfo, Depends(auth.current_user)], user: Annotated[Optional[auth.UserInfo], Depends(auth.current_user_optional)],
): ):
if not is_email_configured(): if not is_email_configured():
raise HTTPException(status_code=400, detail="Email not configured") raise HTTPException(status_code=400, detail="Email not configured")
user_id = user["sub"] user_id = user["sub"] if user else None
transcript = await transcripts_controller.get_by_id_for_http( transcript = await transcripts_controller.get_by_id_for_http(
transcript_id, user_id=user_id transcript_id, user_id=user_id
) )
if not transcript: if not transcript:
raise HTTPException(status_code=404, detail="Transcript not found") raise HTTPException(status_code=404, detail="Transcript not found")
if not transcripts_controller.user_can_mutate(transcript, user_id):
raise HTTPException(status_code=403, detail="Not authorized")
sent = await send_transcript_email([request.email], transcript) sent = await send_transcript_email([request.email], transcript)
return SendEmailResponse(sent=sent) return SendEmailResponse(sent=sent)

View File

@@ -178,14 +178,11 @@ export default function ShareAndPrivacy(props: ShareAndPrivacyProps) {
<ShareZulip <ShareZulip
transcript={props.transcript} transcript={props.transcript}
topics={props.topics} topics={props.topics}
disabled={toShareMode(shareMode.value) === "private"} disabled={toShareMode(shareMode.value) === "public"}
/> />
)} )}
{emailEnabled && ( {emailEnabled && (
<ShareEmail <ShareEmail transcript={props.transcript} disabled={false} />
transcript={props.transcript}
disabled={toShareMode(shareMode.value) === "private"}
/>
)} )}
<ShareCopy <ShareCopy
finalSummaryElement={props.finalSummaryElement} finalSummaryElement={props.finalSummaryElement}