Extract function to create email activity when sending an email to contact #15133
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.
Overview
Extract function that creates an email activity.
Background: I've had a number of requests to save the contents of an email after tokens have been parsed but the way it currently works is it saves a single activity pre-parsing and then creates activity contacts to link it to multiple contacts. This is a more efficient use of the database but a lot less friendly to the end-user admin who can't see what was actually sent to the contact. Note that this PR makes no changes - it just extracts the function that creates the activity so we can consider further refactoring.
Before
Create email activity embedded in main sendMessage function.
After
Create email activity extracted to it's own function.
Technical Details
There should be no functional change with this PR, just simplified/improved code.
Comments