Skip to content
Snippets Groups Projects
Unverified Commit cf1a444c authored by Chad Pilkey's avatar Chad Pilkey Committed by GitHub
Browse files

Merge pull request #8103 from KDSBrowne/issue-8102

Remove Viewers from Users Typing when User list is locked
parents c7d481c0 81c8f222
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@ export default function startTyping(meetingId, userId, chatId) {
userId,
name: user.name,
isTypingTo: chatId,
role: user.role,
time: (new Date()),
};
......
......@@ -3,9 +3,11 @@ import { withTracker } from 'meteor/react-meteor-data';
import Auth from '/imports/ui/services/auth';
import { UsersTyping } from '/imports/api/group-chat-msg';
import Users from '/imports/api/users';
import Meetings from '/imports/api/meetings';
import TypingIndicator from './component';
const CHAT_CONFIG = Meteor.settings.public.chat;
const USER_CONFIG = Meteor.settings.public.user;
const PUBLIC_CHAT_KEY = CHAT_CONFIG.public_id;
const TYPING_INDICATOR_ENABLED = CHAT_CONFIG.typingIndicator.enabled;
......@@ -19,31 +21,39 @@ class TypingIndicatorContainer extends PureComponent {
export default withTracker(() => {
const idChatOpen = Session.get('idChatOpen');
const meeting = Meetings.findOne({ meetingId: Auth.meetingID }, {
fields: {
'lockSettingsProps.hideUserList': 1,
},
});
let selector = {
const selector = {
meetingId: Auth.meetingID,
isTypingTo: PUBLIC_CHAT_KEY,
};
if (idChatOpen !== PUBLIC_CHAT_KEY) {
selector = {
meetingId: Auth.meetingID,
isTypingTo: Auth.userID,
userId: idChatOpen,
};
selector.isTypingTo = Auth.userID;
selector.userId = idChatOpen;
}
const typingUsers = UsersTyping.find(selector).fetch();
const currentUser = Users.findOne({
meetingId: Auth.meetingID,
userId: Auth.userID,
}, {
fields: {
userId: 1,
role: 1,
},
});
if (meeting.lockSettingsProps.hideUserList && currentUser.role === USER_CONFIG.role_viewer) {
selector.role = { $ne: USER_CONFIG.role_viewer };
}
const typingUsers = UsersTyping.find(selector).fetch();
return {
currentUserId: currentUser ? currentUser.userId : null,
typingUsers,
......
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