Add notifications to user when a follow profile posted
This commit is contained in:
@@ -445,6 +445,21 @@ const Notifications = {
|
||||
return this.yourGroupGotANewPost(profile, profile, message, post);
|
||||
}
|
||||
},
|
||||
async yourSubscriptionProfileHasNewPost(post) {
|
||||
const whoPostedId = post.profileid;
|
||||
const message = post.content;
|
||||
const DB = await DBGetter.getDB;
|
||||
const profile = await DB.getProfileCache(whoPostedId);
|
||||
const subscribed_profiles = await DB.getFollowingTheProfile(whoPostedId);
|
||||
subscribed_profiles.forEach((subscribed_id, index) => {
|
||||
const userProfile = subscribed_profiles[index];
|
||||
if (userProfile._id == whoPostedId._id) return 0;
|
||||
const notifBody = `${profile.profile.firstName} posted: ${message.substring(0, 50)}...`;
|
||||
sendPushNotification(userProfile.token, notifBody, {});
|
||||
//sendWebNotification(userProfile.webSubscription, notifBody, message);
|
||||
DB.addNotification(userProfile._id, notifBody, post._id, null, profile._id);
|
||||
});
|
||||
},
|
||||
youHaveAnInvitation,
|
||||
broadcastNews,
|
||||
async yourGroupHasARequest(requesterProfileId, groupId) {
|
||||
|
||||
Reference in New Issue
Block a user