fix email notifications for new posts on groups

This commit is contained in:
aeroreyna
2022-02-16 22:54:34 -08:00
parent f0e1c6b5a9
commit 1e50bcd5e1

View File

@@ -186,7 +186,7 @@ const Notifications = {
DB.addNotification(post.profileid, notifBody, postId, post.comments.length - 1);
return youGotANewPostCommentTemplate(post, userEmail, postProfile, senderProfile, message);
},
async yourGroupGotANewPost(groupProfile, senderProfile, message) {
async yourGroupGotANewPost(groupProfile, senderProfile, message, post) {
const DB = await DBGetter.getDB;
let subscribedPromise = Object.keys(groupProfile.subscribed).map((profileid) => {
return DB.getProfileCache(profileid);
@@ -213,7 +213,7 @@ const Notifications = {
const user = await DB.getUserById(profile.userid);
const senderProfile = await DB.getProfileCache(whoPostedId);
if (profile.isGroup) {
return this.yourGroupGotANewPost(profile, senderProfile, message);
return this.yourGroupGotANewPost(profile, senderProfile, message, post);
}
const notifBody = `${senderProfile.profile.firstName} post in your profile`;
DB.addNotification(toProfileId, notifBody, post._id);