mirror of
https://github.com/PretendoNetwork/juxtaposition-ui.git
synced 2026-09-11 10:55:32 -05:00
Updated conversations markAsRead function to match newMessage function
This commit is contained in:
@@ -44,14 +44,11 @@ ConversationSchema.methods.newMessage = async function(message, senderPID) {
|
||||
await this.save();
|
||||
}
|
||||
|
||||
ConversationSchema.methods.markAsRead = async function(pid) {
|
||||
let users = this.get('users');
|
||||
if(users[0].pid === pid)
|
||||
users[0].read = true;
|
||||
else if(users[1].pid === pid)
|
||||
users[1].read = true;
|
||||
this.set('users', users)
|
||||
this.markModified('users');
|
||||
ConversationSchema.methods.markAsRead = async function(receiverPID) {
|
||||
const receiver = this.users.find(user => user.pid === receiverPID);
|
||||
if (receiver) {
|
||||
receiver.read = true;
|
||||
}
|
||||
await this.save();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user