Improving comments

This commit is contained in:
Adolfo Reyna
2024-06-26 22:59:26 -04:00
parent 533610e0c1
commit 2434840c50
2 changed files with 79 additions and 30 deletions
+8
View File
@@ -11,6 +11,7 @@ const sendWebNotification = async (subscription, title, body) => {
webPush.sendNotification(subscription, payload);
}
// Expo API to send push notifications, this code was a provided snipped
const sendPushNotification = async (profileToken, body, data) => {
if (!profileToken) return 0;
let expo = new Expo();
@@ -94,6 +95,10 @@ const sendPushNotification = async (profileToken, body, data) => {
})();
}
// API to send emails from specific domain.
// TODO: Replace by a generic function, and specifics should be provided
// via enviroment variables.
const sendEmail = async (to, subject, html) => {
let transporter = nodemailer.createTransport({
host: "mail.emmint.com",
@@ -114,6 +119,9 @@ const sendEmail = async (to, subject, html) => {
if (info && info.messageId) console.log("Email sent: %s", info.messageId);
};
// Specific Notification templates
// TODO: This should be replaced by a system of tempaltes.
const yourBookmarkedPostGotACommentTemplate = (post, userEmail, postProfile, senderProfile, bookedProfile, message) => {
let subject = senderProfile.profile.firstName + " commented on the post you follow";
let html = `