notification on commets
This commit is contained in:
@@ -25,15 +25,46 @@ const Notifications = {
|
||||
|
||||
console.log("Message sent: %s", info.messageId);
|
||||
},
|
||||
async youGotANewPost(toProfileId, whoPostedId, Message){
|
||||
async youGotANewPostComment(postId, whoPostedId, Message){
|
||||
const DB = await DBGetter.getDB;
|
||||
const profile = await DB.getProfileCache(toProfileId);
|
||||
const post = await DB.getPost(postId)
|
||||
const profile = await DB.getProfileCache(post.profileid);
|
||||
const user = await DB.getUserById(profile.userid);
|
||||
const senderProfile = await DB.getProfileCache(whoPostedId);
|
||||
let subject = senderProfile.profile.firstName + " post on your profile";
|
||||
let subject = senderProfile.profile.firstName + " comment on your post";
|
||||
let message = `
|
||||
<p>Hello ${profile.profile.firstName},</p>
|
||||
|
||||
<p>You got a comment on your post:</p>
|
||||
|
||||
<blockquote cite="https://social.emmint.com/">
|
||||
<p>${post.content}</p>
|
||||
</blockquote>
|
||||
<figcaption>— You</figcaption>
|
||||
|
||||
<p>Comment:</p>
|
||||
|
||||
<blockquote cite="https://social.emmint.com/">
|
||||
<p>${Message}</p>
|
||||
</blockquote>
|
||||
<figcaption>— ${senderProfile.profile.firstName} ${senderProfile.profile.lastName}</figcaption>
|
||||
|
||||
<p><a href="https://social.emmint.com/">Check it on the site</a></p>
|
||||
|
||||
<p>Blessings</p>
|
||||
|
||||
`;
|
||||
this.sendEmail(user.username, subject, message)
|
||||
},
|
||||
async youGotANewPost(toProfileId, whoPostedId, Message){
|
||||
const DB = await DBGetter.getDB;
|
||||
const profile = await DB.getProfileCache(toProfileId);
|
||||
const user = await DB.getUserById(profile.userid);
|
||||
const senderProfile = await DB.getProfileCache(whoPostedId);
|
||||
let subject = senderProfile.profile.firstName + " post on your profile";
|
||||
let message = `
|
||||
<p>Hello ${profile.profile.firstName},</p>
|
||||
|
||||
<p>You got a new post:</p>
|
||||
|
||||
<blockquote cite="https://social.emmint.com/">
|
||||
@@ -46,8 +77,8 @@ const Notifications = {
|
||||
<p>Blessings</p>
|
||||
|
||||
`;
|
||||
this.sendEmail(user.username, subject, message)
|
||||
}
|
||||
this.sendEmail(user.username, subject, message)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Notifications
|
||||
@@ -77,7 +77,7 @@ DB.getDB.then((DB)=>{
|
||||
lastUpdated: new Date(),
|
||||
reactions: {}
|
||||
}
|
||||
console.log("comment", postid, comment);
|
||||
Notifications.youGotANewPostComment(postid, profileid, content)
|
||||
r = await DB.newComment(postid, comment);
|
||||
return res.json({
|
||||
status: "ok",
|
||||
|
||||
Reference in New Issue
Block a user