Convert rocketchat-action-links to main module structure (#12503)

* First wave of removal of Meteor global

* Second wave of removal of Meteor global

* Third wave of removal of Meteor global

* Fix tests

* Remove global variable SHA256

* Remove global variable WebApp

* Remove global variable EJSON

* Remove global variable Email

* Remove global variable HTTP

* Remove global variable Random

* Remove global variable ReactiveDict

* Remove global variable ReactiveVar

* Remove global variable Accounts

* Remove globals variables Match and check

* Remove global variable Mongo

* Remove global variable moment

* Remove global variable Tracker

* Remove global variable Blaze

* Remove global variables FlowRouter and BlazeLayout

* Add FlowRouter to eslint global in tests file

* Remove global variable DDPRateLimiter

* Remove global variable Session

* Remove global variable UAParser

* Remove global variable Promise

* Remove global variable Reload

* Remove global variable CryptoJS

* Remove global variable Template

* Remove global variable TAPi18n

* Remove global variable TAPi18next

* Exposing t function from rocketchat:ui package

* Convert chatpal search to main module structure

* Fix ESLint

* Convert meteor-accounts-saml to main module structure

* Convert meteor-autocomplete to main module structure

* Convert meteor-timesync package to modular structure

* exposing modal global variable

* Convert rocketchat-2fa to main module structure

* Change exposing of fireGlobalEvent function from window to package

* Moved handleError function from client to rocketchat:lib package

* Convert rocketchat:action-linsk package to main module structure

* disable eslint no-undef in fireGlobalEvent
pull/12506/head^2
Marcos Spessatto Defendi 7 years ago committed by Rodrigo Nascimento
parent a6841f13f1
commit 7c87514ca8
  1. 2
      packages/rocketchat-action-links/both/lib/actionLinks.js
  2. 4
      packages/rocketchat-action-links/client/index.js
  3. 3
      packages/rocketchat-action-links/client/init.js
  4. 1
      packages/rocketchat-action-links/client/lib/actionLinks.js
  5. 23
      packages/rocketchat-action-links/package.js
  6. 1
      packages/rocketchat-action-links/server/actionLinkHandler.js
  7. 2
      packages/rocketchat-action-links/server/index.js
  8. 2
      packages/rocketchat-lib/client/lib/handleError.js
  9. 2
      packages/rocketchat-lib/package.js
  10. 2
      packages/rocketchat-ui/client/lib/fireEvent.js
  11. 5
      packages/rocketchat-ui/package.js

@ -1,4 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
// Action Links namespace creation.
RocketChat.actionLinks = {
actions: {},

@ -0,0 +1,4 @@
import '../both/lib/actionLinks';
import './stylesheets/actionLinks.css';
import './lib/actionLinks';
import './init';

@ -1,6 +1,7 @@
/* globals fireGlobalEvent */
import { Blaze } from 'meteor/blaze';
import { Template } from 'meteor/templating';
import { RocketChat, handleError } from 'meteor/rocketchat:lib';
import { fireGlobalEvent } from 'meteor/rocketchat:ui';
Template.room.events({
'click .action-link'(event, instance) {

@ -1,4 +1,5 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat, handleError } from 'meteor/rocketchat:lib';
// Action Links Handler. This method will be called off the client.
RocketChat.actionLinks.run = (name, messageId, instance) => {

@ -6,18 +6,13 @@ Package.describe({
});
Package.onUse(function(api) {
api.use('ecmascript');
api.use('templating');
api.use('rocketchat:lib');
api.use('rocketchat:theme');
api.use('rocketchat:ui');
api.addFiles('both/lib/actionLinks.js');
api.addFiles('client/lib/actionLinks.js', 'client');
api.addFiles('client/init.js', 'client');
api.addFiles('client/stylesheets/actionLinks.css', 'client');
api.addFiles('server/actionLinkHandler.js', 'server');
api.use([
'ecmascript',
'templating',
'rocketchat:lib',
'rocketchat:theme',
'rocketchat:ui',
]);
api.mainModule('client/index.js', 'client');
api.mainModule('server/index.js', 'server');
});

@ -1,4 +1,5 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
// Action Links Handler. This method will be called off the client.
Meteor.methods({

@ -0,0 +1,2 @@
import '../both/lib/actionLinks';
import './actionLinkHandler';

@ -3,7 +3,7 @@ import _ from 'underscore';
import s from 'underscore.string';
import toastr from 'toastr';
this.handleError = function(error, useToastr = true) {
handleError = function(error, useToastr = true) {
if (_.isObject(error.details)) {
for (const key in error.details) {
if (error.details.hasOwnProperty(key)) {

@ -221,6 +221,7 @@ Package.onUse(function(api) {
api.addFiles('client/lib/roomTypes.js', 'client');
api.addFiles('client/lib/userRoles.js', 'client');
api.addFiles('client/lib/Layout.js', 'client');
api.addFiles('client/lib/handleError.js', 'client');
// CLIENT LIB STARTUP
api.addFiles('client/lib/startup/commands.js', 'client');
@ -250,6 +251,7 @@ Package.onUse(function(api) {
// EXPORT
api.export('RocketChat');
api.export('handleError', 'client');
// exports
api.mainModule('server/lib/index.js', 'server');

@ -1,6 +1,6 @@
import { Tracker } from 'meteor/tracker';
window.fireGlobalEvent = function _fireGlobalEvent(eventName, params) {
fireGlobalEvent = function _fireGlobalEvent(eventName, params) { //eslint-disable-line
window.dispatchEvent(new CustomEvent(eventName, { detail: params }));
Tracker.autorun((computation) => {

@ -146,6 +146,7 @@ Package.onUse(function(api) {
api.addFiles('client/components/contextualBar.js', 'client');
api.export('fileUpload');
api.export('t');
api.export('modal');
api.export('t', 'client');
api.export('modal', 'client');
api.export('fireGlobalEvent', 'client');
});

Loading…
Cancel
Save