DLP on send: warnings, blocks and held mail in the composer
ci / version (pull_request) Skipped
ci / node (pull_request) Successful in 2m13s
ci / publish (pull_request) Skipped
ci / announce (pull_request) Skipped
ci / docker-build (pull_request) Successful in 1m13s

The webmail half of inbuxa's DLP (dlp-and-mail-flow-rules spec, §2.5,
§4):

- A send the server's DLP rules refuse (inbuxa:dlpWarning or
  inbuxa:dlpBlocked) comes back to the composer with the rules' notices
  instead of a generic "Send failed". A warning offers "Send anyway…",
  which asks for a reason and sends again with inbuxa:dlpOverride; the
  server records the reason. A block can only be answered by changing
  the message.
- A message DLP held for review says so on sending ("Held for review:
  it's sent once a reviewer releases it"), from the submission's
  inbuxa:held.
- Tests: the override travels with the submission only when there's a
  reason; refusals are told apart from other errors.

Nine new English strings (the notice labels, the prompt, the toasts);
the other catalogs fall back to English until translated.
This commit is contained in:
jcoffey-dev committed 2026-09-28 18:51:45 -07:00
1 parent 290bc63dbb
commit 07cfe1310e
4 files changed
+134 -7

No files matched your search

+32
View File
@@ -141,6 +141,19 @@ export function Composer({ draft }: { draft: Draft }) {
await send(key);
};
// inbuxa: DLP warned: send anyway with a reason the server records
const sendAnyway = async () => {
const reason = await promptDialog({
title: translate("Send anyway?"),
message: translate("Your reason is recorded with the message."),
placeholder: translate("Why this needs to go"),
confirmLabel: translate("Send anyway"),
});
if (!reason?.trim()) return;
patch({ dlp: null, dlpOverride: reason.trim() });
await send(key);
};
const scheduleFor = (at: Date) => {
sendMenu.close();
setScheduleOpen(false);
@@ -292,6 +305,25 @@ export function Composer({ draft }: { draft: Draft }) {
<button type="button" className="icon-btn sm" aria-label={translate("Dismiss")} onClick={() => patch({ formatOffer: null })}><X size={14} /></button>
</div>
)}
{/*
inbuxa: the server's DLP rules refused the last send. A warning
can be answered with a reason; a block can't, only by changing
the message.
*/}
{d.dlp && (
<div className="composer-notice composer-notice-dlp" role="alert">
<AlertTriangle size={14} />
<span title={d.dlp.rules.map((r) => r.notice).join(" ")}>
{d.dlp.kind === "warning" ? translate("Not sent yet:") : translate("Not sent:")} {d.dlp.rules.map((r) => r.notice).join(" ")}
</span>
{d.dlp.kind === "warning" && (
<button type="button" className="btn btn-sm" onClick={() => void sendAnyway()}>
{translate("Send anyway…")}
</button>
)}
<button type="button" className="icon-btn sm" aria-label={translate("Dismiss")} onClick={() => patch({ dlp: null })}><X size={14} /></button>
</div>
)}
{d.format === "html" ? (
<RichEditor ref={editorRef} html={d.html} onChange={onHtml} placeholder={translate("Write your message…")} spellcheck={settings.spellcheck} onFiles={(files) => addFiles(key, files)} showToolbar={showToolbar} autoFocus={initialFocus === "body"} />
) : (