Closed wlky closed 3 years ago
Merging #18 (4c2fab8) into main (c9cde83) will increase coverage by
0.06%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #18 +/- ##
==========================================
+ Coverage 98.48% 98.55% +0.06%
==========================================
Files 7 7
Lines 461 483 +22
Branches 37 40 +3
==========================================
+ Hits 454 476 +22
Misses 7 7
Impacted Files | Coverage Δ | |
---|---|---|
spec/ApiMailAdapter.spec.js | 100.00% <100.00%> (ø) |
|
spec/helper.js | 100.00% <100.00%> (ø) |
|
src/ApiMailAdapter.js | 95.86% <100.00%> (+0.06%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update c9cde83...4c2fab8. Read the comment docs.
Thanks for submitting this PR.
Would you please also create an issue and reference it in this PR? It helps us to better understand the issue you discovered and your use case.
sure, done. I've also testet this change now and it's working for me. This change allows setting the user when calling the sendEmail function
Parse.Cloud.sendEmail({
templateName: "custom_email",
recipient: a@b.c,
placeholders: request.params.placeholders,
user: request.user
});
This is missing a test case and some docs, can you give me access to your branch and I add this real quick? Otherwise I can open a new branch.
yeah sorry, wasn't sure how to do that stuff :D You should have access to the fork now
@wlky Thanks, I added the tests and did some minor changes. Can you try out if this branch solves the issue for you?
It is now possible to pass the user and a recipient in sendMail
which can seem like a contradiction, because also the user may have an email address:
Parse.Cloud.sendEmail({ recipient: 'a@example.com', user: aUserWithEmailAddress });
To address this I added the logic that if recipient
is not set, the email address of the user user.get('email')
is used as recipient by default. That means if the user object has an email address user.get("email")
, there is one parameter less to set, so it should work with:
Parse.Cloud.sendEmail({
templateName: "custom_email",
placeholders: request.params.placeholders,
user: request.user // user with email address
});
Right now locale callbacks are not working for me, I assume due to the fact that user is always undefined when sending vie Cloud code. This change would allow to supply the email adapter with the user object when sending an email via cloud code (I hope, haven't tested it yet, but it's a very small change) happy about any feedback
Related issue: closes #20