feat(cabana): mail preview and test send to yourself

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-13 13:02:49 +01:00
parent 4fd2ed07eb
commit 0c73c8d4f1
22 changed files with 1233 additions and 16 deletions

View File

@@ -470,6 +470,56 @@
],
"type": "object"
},
"cabana.AdminMailPreviewRequest": {
"properties": {
"id": {
"type": "integer"
},
"mode": {
"type": "string"
},
"values": {
"additionalProperties": {},
"type": "object"
}
},
"required": [
"id",
"mode",
"values"
],
"type": "object"
},
"cabana.AdminMailPreviewResult": {
"properties": {
"html": {
"type": "string"
},
"subject": {
"type": "string"
},
"text": {
"type": "string"
}
},
"required": [
"html",
"subject",
"text"
],
"type": "object"
},
"cabana.AdminMailTestSendResult": {
"properties": {
"email": {
"type": "string"
}
},
"required": [
"email"
],
"type": "object"
},
"cabana.AdminMarkdownPreviewRequest": {
"properties": {
"markdown": {
@@ -1063,6 +1113,36 @@
],
"type": "object"
},
"cabana.Envelope-cabana_AdminMailPreviewResult": {
"properties": {
"data": {
"$ref": "#/components/schemas/cabana.AdminMailPreviewResult"
},
"meta": {
"$ref": "#/components/schemas/cabana.SuccessMeta"
}
},
"required": [
"data",
"meta"
],
"type": "object"
},
"cabana.Envelope-cabana_AdminMailTestSendResult": {
"properties": {
"data": {
"$ref": "#/components/schemas/cabana.AdminMailTestSendResult"
},
"meta": {
"$ref": "#/components/schemas/cabana.SuccessMeta"
}
},
"required": [
"data",
"meta"
],
"type": "object"
},
"cabana.Envelope-cabana_AdminMarkdownPreviewResult": {
"properties": {
"data": {
@@ -4582,6 +4662,180 @@
]
}
},
"/mail/preview": {
"post": {
"description": "Renders an unsaved template, layout, partial or branding draft through postcard's Editor with sample values. Mode template needs system.manage_mail_templates; layout, partial and branding need system.manage_mail_layouts. A draft that does not render is 422 with details field, rule and message.",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.AdminMailPreviewRequest"
}
}
},
"description": "Draft mode, id and form values",
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.Envelope-cabana_AdminMailPreviewResult"
}
}
},
"description": "OK"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Unauthorized"
},
"403": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Forbidden"
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Not Found"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Unprocessable Entity"
}
},
"security": [
{
"BackendBearer": []
}
],
"summary": "Preview a mail draft",
"tags": [
"admin"
]
}
},
"/mail/test-send": {
"post": {
"description": "Sends an unsaved template, layout or partial draft to the signed-in administrator's own email. Interactive sessions only; recipient fields in the body are refused. Limited to five sends per administrator per ten minutes (429 with Retry-After).",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.AdminMailPreviewRequest"
}
}
},
"description": "Draft mode, id and form values",
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.Envelope-cabana_AdminMailTestSendResult"
}
}
},
"description": "OK"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Unauthorized"
},
"403": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Forbidden"
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Not Found"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Unprocessable Entity"
},
"429": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Too Many Requests"
},
"502": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Bad Gateway"
}
},
"security": [
{
"BackendBearer": []
}
],
"summary": "Send a mail draft to yourself",
"tags": [
"admin"
]
}
},
"/markdown/preview": {
"post": {
"description": "Renders the markdown source through cabana.RenderMarkdown (goldmark without unsafe HTML) and answers the sanitized HTML. Output the renderer's gate refuses is a 422 on markdown. Any backend session may call it.",