-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Secure EMail Template Editing with Preview and enhanced UI #486
Comments
@coderabbitai how would you improve this? Give a concrete example. |
Tip For best results, initiate chat on the files or code changes. I notice that this is a comment on a GitHub issue rather than a PR review. Let me analyze the issue and provide concrete suggestions for improving the email template editing system. @ThomasAFink Here's a concrete proposal for improving the email template editing system with preview functionality and enhanced security:
interface EmailTemplate {
id: string;
name: string;
content: string;
version: number;
status: 'draft' | 'published' | 'archived';
createdAt: Date;
updatedAt: Date;
publishedAt?: Date;
createdBy: string;
lastModifiedBy: string;
}
class EmailTemplatePreviewService {
async generatePreview(template: EmailTemplate, testData: any): Promise<string> {
// Sandbox environment for safe TWIG rendering
const sandbox = new TwigSandbox({
allowedTags: ['if', 'for', 'set', ...], // Whitelist safe TWIG tags
allowedFilters: ['escape', 'date', ...], // Whitelist safe filters
});
return await sandbox.render(template.content, testData);
}
}
class EmailTemplateManager {
async createDraft(template: Partial<EmailTemplate>): Promise<EmailTemplate> {
// Create new draft version
}
async updateDraft(id: string, changes: Partial<EmailTemplate>): Promise<EmailTemplate> {
// Update existing draft
}
async publish(id: string): Promise<EmailTemplate> {
// Validate template
// Archive current published version if exists
// Set status to published
// Record publish timestamp
}
async revert(id: string, version: number): Promise<EmailTemplate> {
// Restore template to specific version
}
}
graph TD
A[Template List] --> B[Edit Template]
B --> C[Preview Mode]
B --> D[Version History]
C --> E[Test with Sample Data]
D --> F[Revert to Version]
B --> G[Save Draft]
G --> H[Publish]
Key Features:
UI Workflow:
Would you like me to elaborate on any of these aspects or provide more specific implementation details for any component? (_/)/ |
Cuurently we have a very rudimentary EMail-Template Editor in place. There is no preview functionality. Templates (which contain TWIG-Template-Code) are saved, without version management or history. And they are live immediatly.
We should implement a thorough editing process, including some sort of history and revert functionality, in case something goes wrong.
Sending confirmation emails is one of the central functionalities of this software, since the confirmation mail is a key part of the customer process. Failures in this part of the software will basically stop the main functionalities.
The text was updated successfully, but these errors were encountered: