Notification when accepted on private groups

This commit is contained in:
aeroreyna
2022-03-27 12:02:00 -07:00
parent f7f4592b36
commit 137d91bcc3
2 changed files with 25 additions and 3 deletions

View File

@@ -230,6 +230,21 @@ const yourGroupHasARequestTemplate = (groupProfile, ownerEmail, senderProfile) =
sendEmail(ownerEmail, subject, html)
}
const yourGroupRequestAcceptedTemplate = (groupProfile, acceptedEmail, acceptedProfile) => {
let subject = "Welcome to the " + groupProfile.profile.firstName + " " + groupProfile.profile.lastName + " group";
let html = `
<p>Hello ${acceptedProfile.profile.firstName} ${acceptedProfile.profile.lastName},</p>
<p>Your request to the group ${groupProfile.profile.firstName + groupProfile.profile.lastName} has been accepted.</p>
<p>You can now <a href="https://social.emmint.com/feed/${groupProfile._id}">go to the group</a></p>
<p>Blessings</p>
<p>Emmanuel International Ministries</p>
`;
sendEmail(acceptedEmail, subject, html)
}
const convertLinks = (input) => {
let text = input;
@@ -372,6 +387,13 @@ const Notifications = {
const groupProfile = await DB.getProfileCache(groupId);
const user = await DB.getUserById(groupProfile.userid);
yourGroupHasARequestTemplate(groupProfile, user.username, requesterProfile)
},
async yourGroupRequestAccepted(requesterProfileId, groupId) {
const DB = await DBGetter.getDB;
const requesterProfile = await DB.getProfileCache(requesterProfileId);
const groupProfile = await DB.getProfileCache(groupId);
const user = await DB.getUserById(requesterProfile.userid);
yourGroupRequestAcceptedTemplate(groupProfile, user.username, requesterProfile)
}
}