add actor in internal notifications
This commit is contained in:
+3
-2
@@ -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);
|
const _id = DB.ObjectID(profileid);
|
||||||
let update = {
|
let update = {
|
||||||
$push:{
|
$push:{
|
||||||
@@ -237,7 +237,8 @@ userDB = (DB) => {
|
|||||||
ts: new Date(),
|
ts: new Date(),
|
||||||
body: message,
|
body: message,
|
||||||
postid,
|
postid,
|
||||||
commentIndx
|
commentIndx,
|
||||||
|
actorid,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -321,7 +321,7 @@ const Notifications = {
|
|||||||
if (bookedProfile._id == senderProfile._id) return 0;
|
if (bookedProfile._id == senderProfile._id) return 0;
|
||||||
const notifBody = `${senderProfile.profile.firstName} commented in a post you follow`;
|
const notifBody = `${senderProfile.profile.firstName} commented in a post you follow`;
|
||||||
sendPushNotification(bookedProfile.token, notifBody, {});
|
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);
|
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
|
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`;
|
const notifBody = `${senderProfile.profile.firstName} commented in your post`;
|
||||||
sendPushNotification(postProfile.token, notifBody, {});
|
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);
|
return youGotANewPostCommentTemplate(post, userEmail, postProfile, senderProfile, message);
|
||||||
},
|
},
|
||||||
async yourGroupGotANewPost(groupProfile, senderProfile, message, post) {
|
async yourGroupGotANewPost(groupProfile, senderProfile, message, post) {
|
||||||
@@ -355,7 +355,7 @@ const Notifications = {
|
|||||||
if (userProfile._id == senderProfile._id) return 0; //avoid sending self 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}`;
|
const notifBody = `${senderProfile.profile.firstName} post in the group ${groupProfile.profile.firstName} ${groupProfile.profile.lastName}`;
|
||||||
sendPushNotification(userProfile.token, notifBody, {});
|
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);
|
yourGroupGotANewPostTemplate(groupProfile, userEmail, userProfile, senderProfile, message);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -376,7 +376,7 @@ const Notifications = {
|
|||||||
}
|
}
|
||||||
const notifBody = `${senderProfile.profile.firstName} post in your profile`;
|
const notifBody = `${senderProfile.profile.firstName} post in your profile`;
|
||||||
sendPushNotification(profile.token, notifBody, {});
|
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);
|
return youGotANewPostTemplate(profile, user.username, senderProfile, message);
|
||||||
},
|
},
|
||||||
youHaveAnInvitation,
|
youHaveAnInvitation,
|
||||||
|
|||||||
Reference in New Issue
Block a user