add actor in internal notifications

This commit is contained in:
aeroreyna
2022-04-04 21:30:41 -07:00
parent e7c9d56404
commit 70fffbf55d
2 changed files with 7 additions and 6 deletions

View File

@@ -321,7 +321,7 @@ const Notifications = {
if (bookedProfile._id == senderProfile._id) return 0;
const notifBody = `${senderProfile.profile.firstName} commented in a post you follow`;
sendPushNotification(bookedProfile.token, notifBody, {});
DB.addNotification(bookedProfile._id, notifBody, post._id, post.comments.length - 1);
DB.addNotification(bookedProfile._id, notifBody, post._id, post.comments.length - 1, senderProfile._id);
yourBookmarkedPostGotACommentTemplate(post, userEmail, postProfile, senderProfile, bookedProfile, message);
});
},
@@ -337,7 +337,7 @@ const Notifications = {
if (postProfile.isCourse || senderProfile._id == postProfile._id) return 0; //Course owners do not need to receive notifs
const notifBody = `${senderProfile.profile.firstName} commented in your post`;
sendPushNotification(postProfile.token, notifBody, {});
DB.addNotification(post.profileid, notifBody, postId, post.comments.length - 1);
DB.addNotification(post.profileid, notifBody, postId, post.comments.length - 1, senderProfile._id);
return youGotANewPostCommentTemplate(post, userEmail, postProfile, senderProfile, message);
},
async yourGroupGotANewPost(groupProfile, senderProfile, message, post) {
@@ -355,7 +355,7 @@ const Notifications = {
if (userProfile._id == senderProfile._id) return 0; //avoid sending self notifications
const notifBody = `${senderProfile.profile.firstName} post in the group ${groupProfile.profile.firstName} ${groupProfile.profile.lastName}`;
sendPushNotification(userProfile.token, notifBody, {});
DB.addNotification(userProfile._id, notifBody, post._id);
DB.addNotification(userProfile._id, notifBody, post._id, null, senderProfile._id);
yourGroupGotANewPostTemplate(groupProfile, userEmail, userProfile, senderProfile, message);
});
},
@@ -376,7 +376,7 @@ const Notifications = {
}
const notifBody = `${senderProfile.profile.firstName} post in your profile`;
sendPushNotification(profile.token, notifBody, {});
DB.addNotification(toProfileId, notifBody, post._id);
DB.addNotification(toProfileId, notifBody, post._id, null, senderProfile._id);
return youGotANewPostTemplate(profile, user.username, senderProfile, message);
},
youHaveAnInvitation,