Skip to content
Snippets Groups Projects
Commit ef5a963b authored by syuilo's avatar syuilo
Browse files

wip

parent e21ab77d
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
* Module dependencies
*/
import Message from '../../models/messaging-message';
import Mute from '../../models/mute';
/**
* Get count of unread messages
......@@ -11,8 +12,17 @@ import Message from '../../models/messaging-message';
* @return {Promise<any>}
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
const mute = await Mute.find({
muter_id: user._id,
deleted_at: { $exists: false }
});
const mutedUserIds = mute.map(m => m.mutee_id);
const count = await Message
.count({
user_id: {
$nin: mutedUserIds
},
recipient_id: user._id,
is_read: false
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment