2018-03-10 02:42:14 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
|
2021-10-20 04:35:39 +08:00
|
|
|
const collectionOptions = Meteor.isClient ? {
|
|
|
|
connection: null,
|
|
|
|
} : {};
|
|
|
|
|
2018-07-26 22:56:26 +08:00
|
|
|
const GroupChatMsg = new Mongo.Collection('group-chat-msg');
|
2021-10-20 04:35:39 +08:00
|
|
|
const UsersTyping = new Mongo.Collection('users-typing', collectionOptions);
|
2018-03-10 02:42:14 +08:00
|
|
|
|
|
|
|
if (Meteor.isServer) {
|
2018-07-26 22:56:26 +08:00
|
|
|
GroupChatMsg._ensureIndex({ meetingId: 1, chatId: 1 });
|
2019-08-15 02:39:15 +08:00
|
|
|
UsersTyping._ensureIndex({ meetingId: 1, isTypingTo: 1 });
|
2018-03-10 02:42:14 +08:00
|
|
|
}
|
|
|
|
|
2021-09-22 21:05:43 +08:00
|
|
|
// As we store chat in context, skip adding to mini mongo
|
2021-09-22 01:33:54 +08:00
|
|
|
if (Meteor.isClient) {
|
|
|
|
GroupChatMsg.onAdded = () => false;
|
|
|
|
}
|
|
|
|
|
2019-08-03 02:18:33 +08:00
|
|
|
export { GroupChatMsg, UsersTyping };
|