<commit_before>import Users from 'meteor/vulcan:users';
import schema from './schema.js';
import { createCollection, getDefaultResolvers, getDefaultMutations } from 'meteor/vulcan:core';
import './permissions.js';

/**
 * @summary Telescope Conversations namespace
 * @namespace Conversations
 */

const options = {
     checkNew: (user, document) => {
       if (!user || !document) return false;
       return document.participantIds.includes(user._id) ? Users.canDo(user, 'conversation.new.own') : Users.canDo(user, `conversation.new.all`)},

     checkEdit: (user, document) => {
       if (!user || !document) return false;
       return document.participantIds.includes(user._id) ? Users.canDo(user, 'conversation.edit.own') : Users.canDo(user, `conversation.edit.all`)
     },

     checkRemove: (user, document) => {
       if (!user || !document) return false;
       return document.participantIds.includes(user._id) ? Users.canDo(user, 'conversation.remove.own') : Users.canDo(user, `conversation.remove.all`)
     },
 }

const Conversations = createCollection({

  collectionName: 'Conversations',

  typeName: 'Conversation',

  schema,

  resolvers: getDefaultResolvers('Conversations'),

  mutations: getDefaultMutations('Conversations', options)

});

export default Conversations;

// Conversations,<commit_msg>Bug fix. Forgot the letter 's'.<commit_after>import Users from 'meteor/vulcan:users';
import schema from './schema.js';
import { createCollection, getDefaultResolvers, getDefaultMutations } from 'meteor/vulcan:core';
import './permissions.js';

/**
 * @summary Telescope Conversations namespace
 * @namespace Conversations
 */

const options = {
     checkNew: (user, document) => {
       console.log(document);
       if (!user || !document) return false;
       return document.participantIds.includes(user._id) ? Users.canDo(user, 'conversations.new.own') : Users.canDo(user, `conversations.new.all`)
     },

     checkEdit: (user, document) => {
       if (!user || !document) return false;
       return document.participantIds.includes(user._id) ? Users.canDo(user, 'conversations.edit.own') : Users.canDo(user, `conversations.edit.all`)
     },

     checkRemove: (user, document) => {
       if (!user || !document) return false;
       return document.participantIds.includes(user._id) ? Users.canDo(user, 'conversations.remove.own') : Users.canDo(user, `conversations.remove.all`)
     },
 }

const Conversations = createCollection({

  collectionName: 'Conversations',

  typeName: 'Conversation',

  schema,

  resolvers: getDefaultResolvers('Conversations'),

  mutations: getDefaultMutations('Conversations', options)

});

export default Conversations;

// Conversations,
{'fraction_non_alphanumeric': 0.14212076583210603, 'fraction_numerical': 0.0, 'mean_word_length': 4.317025440313111, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4739344', 'n_tokens_mistral': 851, 'n_tokens_neox': 821, 'n_words': 171}