clean up typingUsers fetch()

This commit is contained in:
KDSBrowne 2019-08-22 18:17:30 +00:00
parent 121752cc6c
commit 10946d16bd
2 changed files with 17 additions and 8 deletions

View File

@ -217,6 +217,7 @@ class MessageForm extends PureComponent {
}
const handleUserTyping = () => {
if (error) return;
startUserTyping(chatId);
};

View File

@ -19,18 +19,26 @@ class ChatContainer extends PureComponent {
}
export default withTracker(() => {
const idChatOpen = Session.get('idChatOpen');
const cleanScrollAndSendMessage = (message) => {
ChatService.updateScrollPosition(null);
return ChatService.sendGroupMessage(message);
};
const typingUsers = UsersTyping.find({
meetingId: Auth.meetingID,
$or: [
{ isTypingTo: PUBLIC_CHAT_KEY },
{ isTypingTo: Auth.userID },
],
}).fetch();
let typingUsers = null;
if (idChatOpen === 'public') {
typingUsers = UsersTyping.find({
meetingId: Auth.meetingID,
isTypingTo: PUBLIC_CHAT_KEY,
}).fetch();
} else {
typingUsers = UsersTyping.find({
meetingId: Auth.meetingID,
isTypingTo: Auth.userID,
userId: idChatOpen,
}).fetch();
}
const currentUser = Users.findOne({
meetingId: Auth.meetingID,
@ -50,7 +58,7 @@ export default withTracker(() => {
stopUserTyping,
currentUserId: currentUser ? currentUser.userId : null,
typingUsers,
currentChatPartner: Session.get('idChatOpen'),
currentChatPartner: idChatOpen,
UnsentMessagesCollection: ChatService.UnsentMessagesCollection,
minMessageLength: CHAT_CONFIG.min_message_length,
maxMessageLength: CHAT_CONFIG.max_message_length,