Skip to content

Commit

Permalink
[FIX] Loading user list from room messages (#13769)
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego committed Mar 18, 2019
1 parent 5851725 commit db32757
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/ui-message/client/popup/messagePopupConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ import _ from 'underscore';

const usersFromRoomMessages = new Mongo.Collection(null);

const reloadUsersFromRoomMessages = (userId, rid) => {
const user = Meteor.users.findOne(userId, { fields: { username: 1 } });

const reloadUsersFromRoomMessages = (fromUsername, rid) => {
usersFromRoomMessages.remove({});
const uniqueMessageUsersControl = {};

Messages.find({
rid,
'u.username': { $ne: user.username },
'u.username': { $ne: fromUsername },
t: { $exists: false },
},
{
Expand Down Expand Up @@ -56,7 +54,12 @@ Meteor.startup(function() {
return;
}

reloadUsersFromRoomMessages(userId, rid);
const user = Meteor.users.findOne(userId, { fields: { username: 1 } });
if (!user || !user.username) {
return;
}

reloadUsersFromRoomMessages(user.username, rid);
});
});

Expand Down

0 comments on commit db32757

Please sign in to comment.