Skip to content

Commit

Permalink
i added 2 more tests for the file data.js file to increase the coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
jdufitum committed Sep 5, 2024
1 parent 2f727cb commit 7e5d83d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/messaging/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,15 @@ module.exports = function (Messaging) {
if (!parentMids.length) {
return;
}
// Get the unique parent mids
parentMids = _.uniq(parentMids);
const canView = await Messaging.canViewMessage(parentMids, roomId, uid);
parentMids = parentMids.filter((mid, idx) => canView[idx]);

const parentMessages = await Messaging.getMessagesFields(parentMids, [
'fromuid', 'content', 'timestamp', 'deleted',
]);
// Get the unique parent uids
const parentUids = _.uniq(parentMessages.map(msg => msg && msg.fromuid));
const usersMap = _.zipObject(
parentUids,
Expand Down

0 comments on commit 7e5d83d

Please sign in to comment.