Merged
Conversation
Reviewer's GuideAdds attachment support to the Nodemailer notification adapter and aligns the package with vintasend v0.4.0, including tests for attachment handling. Sequence diagram for sending an email with attachments via NodemailerNotificationAdaptersequenceDiagram
actor System
participant Adapter as NodemailerNotificationAdapter
participant Renderer as BaseEmailTemplateRenderer
participant Notification as AnyDatabaseNotification
participant FileStore as StoredAttachment_file
participant Transporter as Nodemailer_Transporter
System->>Adapter: send(notification, context)
Adapter->>Adapter: check backend injected
Adapter->>Renderer: render(notification, context)
Renderer-->>Adapter: template
Adapter->>Adapter: build mailOptions (from, to, subject, text, html)
Adapter->>Notification: read attachments
alt attachments present
loop for each StoredAttachment
Adapter->>FileStore: att.file.read()
FileStore-->>Adapter: content (Buffer)
end
Adapter->>Adapter: prepareAttachments(attachments)
Adapter-->>Adapter: Mail_Attachment[]
Adapter->>Adapter: attach to mailOptions.attachments
else no attachments
Adapter->>Adapter: send without mailOptions.attachments
end
Adapter->>Transporter: sendMail(mailOptions)
Transporter-->>Adapter: result
Adapter-->>System: void
Updated class diagram for NodemailerNotificationAdapter with attachment supportclassDiagram
class BaseNotificationAdapter {
}
class BaseEmailTemplateRenderer {
}
class AnyDatabaseNotification {
+attachments StoredAttachment[]
}
class StoredAttachment {
+filename string
+contentType string
+file StoredAttachment_file
}
class StoredAttachment_file {
+read() Promise_Buffer
}
class Mail_Attachment {
+filename string
+content any
+contentType string
}
class NodemailerNotificationAdapter {
-transporter Nodemailer_Transporter
+constructor(transportOptions any)
+get supportsAttachments() boolean
+send(notification AnyDatabaseNotification, context JsonObject) Promise_void
+prepareAttachments(attachments StoredAttachment[]) Promise_Mail_Attachment_array
}
class Nodemailer_Transporter {
+sendMail(mailOptions any) Promise_any
}
BaseNotificationAdapter <|-- NodemailerNotificationAdapter
NodemailerNotificationAdapter o--> BaseEmailTemplateRenderer : uses
NodemailerNotificationAdapter o--> Nodemailer_Transporter : has
AnyDatabaseNotification o--> StoredAttachment : has
StoredAttachment o--> StoredAttachment_file : has
NodemailerNotificationAdapter ..> AnyDatabaseNotification : send parameter
NodemailerNotificationAdapter ..> StoredAttachment : prepareAttachments parameter
NodemailerNotificationAdapter ..> Mail_Attachment : returns array
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Add attachment support to the Nodemailer notification adapter and align package and dependency versions with the corresponding Vintasend release.
New Features:
Enhancements:
Build:
Tests: