feat(inout): 발주 메일 미리보기에서 본문 바로 고치기

미리보기 창을 눌러 글·표를 고치면 고친 본문 그대로 발송(안 고치면 서버 본문).
서버가 허용 태그·인라인 서식만 남기고 글 버전도 다시 만든다. [원래 본문으로]·닫을 때 확인.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 12:09:40 +09:00
parent 7275f12a74
commit f4d7e9588f
10 changed files with 221 additions and 14 deletions
+4
View File
@@ -718,6 +718,8 @@ def mail_send(request: Request, order_id: int, payload: dict[str, Any] = Body(..
try:
to = store.parse_emails(payload.get("to"), label="받는 사람", required=True)
cc = store.parse_emails(payload.get("cc"), label="참조")
# 미리보기 창에서 본문을 고쳤으면 그 HTML(2026-10-27) — 안 고쳤으면 보내지 않고 서버가 만든 본문 그대로
edited = store.clean_mail_html(payload["html"]) if payload.get("html") else None
except ValueError as exc:
raise HTTPException(status_code=400, detail=str(exc)) from None
if order["mails"] and not payload.get("resend"):
@@ -728,6 +730,8 @@ def mail_send(request: Request, order_id: int, payload: dict[str, Any] = Body(..
return JSONResponse({"ok": False, "reconnect": True, "message": "Gmail 이 연결되지 않았습니다 — 먼저 [Gmail 연결]을 하세요."},
status_code=409)
mail = store.order_mail(order, sender_name=str(user.get("name") or ""), sender_email=email)
if edited is not None:
mail = {**mail, "html": edited, "text": store.mail_html_to_text(edited)}
try:
refresh = gmail.decrypt_token(email, row["refresh_token_enc"])
raw = gmail.build_message(sender_name=str(user.get("name") or ""), sender_email=email, to=to, cc=cc,