add actor in internal notifications
This commit is contained in:
@@ -229,7 +229,7 @@ userDB = (DB) => {
|
||||
});
|
||||
}
|
||||
|
||||
DB.addNotification = async (profileid, message, postid, commentIndx) => {
|
||||
DB.addNotification = async (profileid, message, postid, commentIndx, actorid) => {
|
||||
const _id = DB.ObjectID(profileid);
|
||||
let update = {
|
||||
$push:{
|
||||
@@ -237,7 +237,8 @@ userDB = (DB) => {
|
||||
ts: new Date(),
|
||||
body: message,
|
||||
postid,
|
||||
commentIndx
|
||||
commentIndx,
|
||||
actorid,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user