Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-env mocha */
/* eslint-disable prefer-arrow-callback, func-names, camelcase */
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import { Accounts } from 'meteor/accounts-base';
import { assert } from 'chai';
import { resetDatabase } from 'meteor/xolvio:cleaner';
import { Instances, Questions, Answers, Votes } from '/lib/common.js';
import './methods.js';
if (Meteor.isServer) {
describe('Methods', function () {
const test_admin = {
email: 'admin@admins.us',
password: Random.hexString(10),
profile: {
name: 'Ms. Admin',
},
};
const test_mod = {
email: 'mod@mods.us',
password: Random.hexString(10),
profile: {
name: 'Mod McMod',
},
};
import "/imports/api/locations/methods";
import "/imports/api/queues/methods";
import "/imports/api/queues/helpers";
import "/imports/api/sessions/methods";
import "/imports/api/sessions/helpers";
import "/imports/api/tickets/methods";
import "/imports/api/tickets/helpers";
import "/imports/api/users/users";
import "/imports/api/users/helpers";
import "/imports/api/users/methods";
if (Meteor.isServer) {
/* eslint-disable global-require */
require("/imports/api/announcements/server/publications.js");
require("/imports/api/courses/server/publications.js");
require("/imports/api/locations/server/publications.js");
require("/imports/api/queues/server/publications.js");
require("/imports/api/sessions/server/publications.js");
require("/imports/api/tickets/server/publications.js");
require("/imports/api/users/server/publications.js");
/* eslint-enable global-require */
}
import { Meteor } from 'meteor/meteor';
const Polls = new Mongo.Collection('polls2x');
if (Meteor.isServer) {
// We can have just one active poll per meeting
// makes no sense to index it by anything other than meetingId
Polls._ensureIndex({ meetingId: 1 });
}
export default Polls;
tweetstream.push(tweet)
}
})
console.log(tweetstream)
});
Template.body.helpers({
main: function() {
if (ActiveRoute.path('/')) return 'home'
else return 'vis'
},
tweet: function() {
return tweet.find().fetch()
}
})
}
if (Meteor.isServer) {
tweets.allow({
insert: function() {
return true;
},
update: function() {
return true;
},
remove: function() {
return true;
}
});
if (tweets.find().count() == 0) {
tweets.insert({ "name": "ultybs scjhkv", "handle": "zqwvteop", "date": 1470715200000, "num_retweets": 28, "location": { "type": "Point", "coordinates": [-168.11289992853986, 40.92125425551876] }, "content": "miubkotohagiqjurbnydwchbgigpzznkbhlccvvwfbgmwtzebwbzmqysovcjxzburhfmeckrvyomkfmnkeoirnpotmbzydnxcigvkmukornvgiewyhkozuirqshklorwpjssoblztuvr", "risk_level": 86 });
}
Meteor.publish("tweet", function() {
return tweets.find();
Meteor.startup(() => {
if (Meteor.isServer) {
PieceInstances._ensureIndex({
rundownId: 1,
partInstanceId: 1
})
}
})
function exportCards(cardset_id, isCardsExport = true, exportWithIds = false) {
if (Meteor.isServer) {
let owner = Cardsets.findOne(cardset_id).owner;
var cards = [];
if (exportWithIds) {
cards = Cards.find({
cardset_id: cardset_id
}, {
fields: {
'cardset_id': 0,
'cardGroup': 0,
'cardType': 0,
'difficulty': 0
}, sort: {
'subject': 1,
'front': 1
}
}).fetch();
import {Meteor} from "meteor/meteor";
export const Colleges = new TAPi18n.Collection("colleges");
if (Meteor.isServer) {
Meteor.publish("colleges", function () {
return Colleges.find();
});
}
import { Meteor } from 'meteor/meteor';
import { OnlineUsersSchema } from './onlineusers.schema';
import { check } from 'meteor/check';
import moment from 'moment/moment';
if (Meteor.isServer) {
Meteor.publish('onlineUsersForRoute', function (route) {
return OnlineUsersSchema.find({activeRoute: route});
});
}
const checkRouteParamAndAuthorization = (route, userId) => {
check(route, String);
if (!userId) {
throw new Meteor.Error('not-authorized');
}
};
Meteor.methods({
'onlineUsers.enterRoute'(route) {
const userId = Meteor.userId();
checkRouteParamAndAuthorization(route, userId);
Meteor.startup(() => {
if (Meteor.isServer) {
ObserveChangesForHash(Studios, '_rundownVersionHash', ['config'])
}
})
const implement = (method, { mixins = [], onServer, ...options } = {}) => {
const adjustedOptions = { ...options };
const name = method.getName();
if (onServer) {
let func = () => {};
if (Meteor.isServer) {
func = onServer();
}
if (!func) {
throw new Error(`Invalid method definition, check "onServer" for ${method.getName()}`);
}
if (options.run) {
throw new Error('When "onServer" is provided, "run" is not allowed');
}
adjustedOptions.run = function (...args) {
if (!this.userId) {
throw new Meteor.Error(`${name}.notAllowed`, 'You must be logged in');
}
return func(this, ...args);
};
}
return new ValidatedMethod({