Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of Meteor global variable #12371

Merged
merged 7 commits into from
Nov 1, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"LivechatTrigger" : false,
"Logger" : false,
"Match" : false,
"Meteor" : false,
"modal" : false,
"moment" : false,
"Mongo" : false,
Expand Down
1 change: 1 addition & 0 deletions client/methods/deleteMessage.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import _ from 'underscore';
import moment from 'moment';

Expand Down
1 change: 1 addition & 0 deletions client/methods/hideRoom.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
Meteor.methods({
hideRoom(rid) {
if (!Meteor.userId()) {
Expand Down
1 change: 1 addition & 0 deletions client/methods/openRoom.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
Meteor.methods({
openRoom(rid) {
if (!Meteor.userId()) {
Expand Down
1 change: 1 addition & 0 deletions client/methods/setUserActiveStatus.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
Meteor.methods({
setUserActiveStatus(userId, active) {
Meteor.users.update(userId, { $set: { active } });
Expand Down
1 change: 1 addition & 0 deletions client/methods/toggleFavorite.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
Meteor.methods({
toggleFavorite(rid, f) {
if (!Meteor.userId()) {
Expand Down
1 change: 1 addition & 0 deletions client/methods/updateMessage.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import _ from 'underscore';
import moment from 'moment';
import toastr from 'toastr';
Expand Down
2 changes: 2 additions & 0 deletions client/notifications/UsersNameChanged.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Meteor } from 'meteor/meteor';

Meteor.startup(function() {
RocketChat.Notifications.onLogged('Users:NameChanged', function({ _id, name, username }) {
RocketChat.models.Messages.update({
Expand Down
1 change: 1 addition & 0 deletions client/notifications/notification.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* globals KonchatNotification, fireGlobalEvent, readMessage, CachedChatSubscription */
import { Meteor } from 'meteor/meteor';

// Show notifications and play a sound for new messages.
// We trust the server to only send notifications for interesting messages, e.g. direct messages or
Expand Down
1 change: 1 addition & 0 deletions client/notifications/updateAvatar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* globals updateAvatarOfUsername */
import { Meteor } from 'meteor/meteor';

Meteor.startup(function() {
RocketChat.Notifications.onLogged('updateAvatar', function(data) {
Expand Down
1 change: 1 addition & 0 deletions client/notifications/updateUserState.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* globals fireGlobalEvent */
import { Meteor } from 'meteor/meteor';

/* fire user state change globally, to listen on desktop electron client */
Meteor.startup(function() {
Expand Down
1 change: 1 addition & 0 deletions client/routes/router.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* globals KonchatNotification */
import { Meteor } from 'meteor/meteor';
import s from 'underscore.string';

Blaze.registerHelper('pathFor', function(path, kw) {
Expand Down
1 change: 1 addition & 0 deletions client/startup/emailVerification.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import toastr from 'toastr';
Meteor.startup(function() {
Tracker.autorun(function() {
Expand Down
1 change: 1 addition & 0 deletions client/startup/i18n.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* globals isRtl */

import { Meteor } from 'meteor/meteor';
import moment from 'moment';

const currentLanguage = new ReactiveVar();
Expand Down
1 change: 1 addition & 0 deletions client/startup/loginViaQuery.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
Meteor.startup(() => {
if (FlowRouter.getQueryParam('resumeToken')) {
Meteor.loginWithToken(FlowRouter.getQueryParam('resumeToken'), () => {
Expand Down
1 change: 1 addition & 0 deletions client/startup/roomObserve.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
Meteor.startup(function() {
ChatRoom.find().observe({
added(data) {
Expand Down
2 changes: 1 addition & 1 deletion client/startup/startup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* globals UserPresence, fireGlobalEvent */

import { Meteor } from 'meteor/meteor';
import toastr from 'toastr';
import hljs from 'highlight.js';
import 'highlight.js/styles/github.css';
Expand Down
2 changes: 1 addition & 1 deletion client/startup/unread.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* globals fireGlobalEvent, readMessage, Favico, favico, menu */

import { Meteor } from 'meteor/meteor';
Meteor.startup(function() {
Tracker.autorun(function() {
let unreadCount = 0;
Expand Down
1 change: 1 addition & 0 deletions client/startup/userSetUtcOffset.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import moment from 'moment';

Meteor.startup(function() {
Expand Down
1 change: 1 addition & 0 deletions client/startup/usersObserve.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
Meteor.startup(function() {
Meteor.users.find({}, { fields: { name: 1, username: 1, pictures: 1, status: 1, emails: 1, phone: 1, services: 1, utcOffset: 1 } }).observe({
added(user) {
Expand Down
1 change: 1 addition & 0 deletions imports/message-read-receipt/client/readReceipts.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import moment from 'moment';

Expand Down
1 change: 1 addition & 0 deletions imports/message-read-receipt/server/lib/ReadReceipt.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import ModelReadReceipts from '../models/ReadReceipts';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import toastr from 'toastr';
import moment from 'moment';
Expand Down
1 change: 1 addition & 0 deletions packages/chatpal-search/client/template/admin.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import toastr from 'toastr';

Template.ChatpalAdmin.onCreated(function() {
Expand Down
1 change: 1 addition & 0 deletions packages/chatpal-search/server/provider/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import ChatpalLogger from '../utils/logger';
import { Random } from 'meteor/random';

Expand Down
1 change: 1 addition & 0 deletions packages/chatpal-search/server/provider/provider.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import { searchProviderService, SearchProvider } from 'meteor/rocketchat:search';
import Index from './index';
import ChatpalLogger from '../utils/logger';
Expand Down
1 change: 1 addition & 0 deletions packages/chatpal-search/server/utils/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
Meteor.methods({
'chatpalUtilsCreateKey'(email) {
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/meteor-accounts-saml/saml_client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* globals cordova */

import { Meteor } from 'meteor/meteor';
if (!Accounts.saml) {
Accounts.saml = {};
}
Expand Down
1 change: 1 addition & 0 deletions packages/meteor-accounts-saml/saml_rocketchat.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
const logger = new Logger('steffo:meteor-accounts-saml', {
methods: {
updated: {
Expand Down
1 change: 1 addition & 0 deletions packages/meteor-accounts-saml/saml_server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* globals RoutePolicy, SAML */
/* jshint newcap: false */
import { Meteor } from 'meteor/meteor';
import _ from 'underscore';

if (!Accounts.saml) {
Expand Down
1 change: 1 addition & 0 deletions packages/meteor-accounts-saml/saml_utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* globals SAML:true */

import { Meteor } from 'meteor/meteor';
import zlib from 'zlib';
import xmlCrypto from 'xml-crypto';
import crypto from 'crypto';
Expand Down
1 change: 1 addition & 0 deletions packages/meteor-autocomplete/client/autocomplete-client.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* globals Deps, getCaretCoordinates*/
import { Meteor } from 'meteor/meteor';
import _ from 'underscore';
import AutoCompleteRecords from './collection';

Expand Down
1 change: 1 addition & 0 deletions packages/meteor-autocomplete/server/autocomplete-server.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
// This also attaches an onStop callback to sub, so we don't need to worry about that.
// https://github.com/meteor/meteor/blob/devel/packages/mongo/collection.js
const Autocomplete = class {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-2fa/client/TOTPPassword.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import toastr from 'toastr';

function reportError(error, callback) {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-2fa/client/accountSecurity.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import toastr from 'toastr';
import qrcode from 'yaqrcode';

Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-2fa/server/loginHandler.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
Accounts.registerLoginHandler('totp', function(options) {
if (!options.totp || !options.totp.code) {
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
Meteor.methods({
'2fa:checkCodesRemaining'() {
if (!Meteor.userId()) {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-2fa/server/methods/disable.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
Meteor.methods({
'2fa:disable'(code) {
if (!Meteor.userId()) {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-2fa/server/methods/enable.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
Meteor.methods({
'2fa:enable'() {
if (!Meteor.userId()) {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-2fa/server/methods/regenerateCodes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
Meteor.methods({
'2fa:regenerateCodes'(userToken) {
if (!Meteor.userId()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
Meteor.methods({
'2fa:validateTempToken'(userToken) {
if (!Meteor.userId()) {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-action-links/both/lib/actionLinks.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
// Action Links namespace creation.
RocketChat.actionLinks = {
actions: {},
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-action-links/client/lib/actionLinks.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
// Action Links Handler. This method will be called off the client.

RocketChat.actionLinks.run = (name, messageId, instance) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
// Action Links Handler. This method will be called off the client.

Meteor.methods({
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-analytics/client/loadScript.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
Template.body.onRendered(() => {
Tracker.autorun((c) => {
const piwikUrl = RocketChat.settings.get('PiwikAnalytics_enabled') && RocketChat.settings.get('PiwikAnalytics_url');
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-analytics/client/trackEvents.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
function trackEvent(category, action, label) {
if (window._paq) {
window._paq.push(['trackEvent', category, action, label]);
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-api/server/api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* global Restivus, DDP, DDPCommon */
import { Meteor } from 'meteor/meteor';

import _ from 'underscore';
const logger = new Logger('API', {});

Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-api/server/helpers/getUserFromParams.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Convenience method, almost need to turn it into a middleware of sorts
import { Meteor } from 'meteor/meteor';

RocketChat.API.helperMethods.set('getUserFromParams', function _getUserFromParams() {
const doesntExist = { _doesntExist: true };
let user;
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-api/server/helpers/parseJsonQuery.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Meteor } from 'meteor/meteor';

RocketChat.API.helperMethods.set('parseJsonQuery', function _parseJsonQuery() {
let sort;
if (this.queryParams.sort) {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-api/server/v1/assets.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import Busboy from 'busboy';

RocketChat.API.v1.addRoute('assets.setAsset', { authRequired: true }, {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-api/server/v1/channels.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import _ from 'underscore';

// Returns the channel IF found otherwise it will return the failure of why it didn't. Check the `statusCode` property
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-api/server/v1/chat.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* global processWebhookMessage */
import { Meteor } from 'meteor/meteor';

RocketChat.API.v1.addRoute('chat.delete', { authRequired: true }, {
post() {
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-api/server/v1/commands.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Meteor } from 'meteor/meteor';

RocketChat.API.v1.addRoute('commands.get', { authRequired: true }, {
get() {
const params = this.queryParams;
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-api/server/v1/e2e.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Meteor } from 'meteor/meteor';

RocketChat.API.v1.addRoute('e2e.fetchMyKeys', { authRequired: true }, {
get() {
let result;
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-api/server/v1/emoji-custom.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
RocketChat.API.v1.addRoute('emoji-custom', { authRequired: true }, {
get() {
const emojis = Meteor.call('listEmojiCustom');
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-api/server/v1/groups.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import _ from 'underscore';

// Returns the private group subscription IF found otherwise it will return the failure of why it didn't. Check the `statusCode` property
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-api/server/v1/im.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Meteor } from 'meteor/meteor';

function findDirectMessageRoom(params, user) {
if ((!params.roomId || !params.roomId.trim()) && (!params.username || !params.username.trim())) {
throw new Meteor.Error('error-room-param-not-provided', 'Body param "roomId" or "username" is required');
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-api/server/v1/integrations.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Meteor } from 'meteor/meteor';

RocketChat.API.v1.addRoute('integrations.create', { authRequired: true }, {
post() {
check(this.bodyParams, Match.ObjectIncluding({
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-api/server/v1/misc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';

RocketChat.API.v1.addRoute('info', { authRequired: false }, {
get() {
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-api/server/v1/permissions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Meteor } from 'meteor/meteor';

/**
This API returns all permissions that exists
on the server, with respective roles.
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-api/server/v1/push.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* globals Push */
import { Meteor } from 'meteor/meteor';

RocketChat.API.v1.addRoute('push.token', { authRequired: true }, {
post() {
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-api/server/v1/roles.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Meteor } from 'meteor/meteor';

RocketChat.API.v1.addRoute('roles.list', { authRequired: true }, {
get() {
const roles = RocketChat.models.Roles.find({}, { fields: { _updatedAt: 0 } }).fetch();
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-api/server/v1/rooms.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import Busboy from 'busboy';

function findRoomByIdOrName({ params, checkedArchived = true }) {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-api/server/v1/settings.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import _ from 'underscore';

// settings endpoints
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-api/server/v1/stats.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Meteor } from 'meteor/meteor';

RocketChat.API.v1.addRoute('statistics', { authRequired: true }, {
get() {
let refresh = false;
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-api/server/v1/subscriptions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Meteor } from 'meteor/meteor';

RocketChat.API.v1.addRoute('subscriptions.get', { authRequired: true }, {
get() {
const { updatedSince } = this.queryParams;
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-api/server/v1/users.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import _ from 'underscore';
import Busboy from 'busboy';

Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-apps/client/admin/appManage.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import _ from 'underscore';
import s from 'underscore.string';
import toastr from 'toastr';
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-apps/client/admin/appWhatIsIt.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Meteor } from 'meteor/meteor';

Template.appWhatIsIt.onCreated(function() {
this.isLoading = new ReactiveVar(false);
this.hasError = new ReactiveVar(false);
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-apps/client/communication/websockets.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Meteor } from 'meteor/meteor';

export const AppEvents = Object.freeze({
APP_ADDED: 'app/added',
APP_REMOVED: 'app/removed',
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-apps/client/orchestrator.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import { AppWebsocketReceiver } from './communication';
import { Utilities } from '../lib/misc/Utilities';

Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-apps/server/bridges/api.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import express from 'express';
import { WebApp } from 'meteor/webapp';

Expand Down
Loading