Skip to content

Commit

Permalink
Convert rocketchat-otr to main module structure (#12777)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcosSpessatto authored and rodrigok committed Dec 3, 2018
1 parent e5c797b commit a777718
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 20 deletions.
6 changes: 6 additions & 0 deletions packages/rocketchat-otr/client/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import './stylesheets/otr.css';
import './rocketchat.otr';
import './rocketchat.otr.room';
import './views/otrFlexTab.html';
import './views/otrFlexTab';
import './tabBar';
2 changes: 2 additions & 0 deletions packages/rocketchat-otr/client/rocketchat.otr.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { Tracker } from 'meteor/tracker';
import { RocketChat } from 'meteor/rocketchat:lib';
import { t } from 'meteor/rocketchat:ui';

class OTR {
constructor() {
Expand Down
3 changes: 2 additions & 1 deletion packages/rocketchat-otr/client/rocketchat.otr.room.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import { Tracker } from 'meteor/tracker';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { TAPi18n } from 'meteor/tap:i18n';
import { TimeSync } from 'meteor/mizzao:timesync';
import { RocketChat } from 'meteor/rocketchat:lib';
import { modal } from 'meteor/rocketchat:ui';
import _ from 'underscore';
import toastr from 'toastr';
/* globals crypto */

RocketChat.OTR.Room = class {
constructor(userId, roomId) {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-otr/client/tabBar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { RocketChat } from 'meteor/rocketchat:lib';

Meteor.startup(function() {
Tracker.autorun(function() {
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-otr/client/views/otrFlexTab.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { RocketChat } from 'meteor/rocketchat:lib';
import { modal } from 'meteor/rocketchat:ui';

Template.otrFlexTab.helpers({
otrAvailable() {
Expand Down
22 changes: 3 additions & 19 deletions packages/rocketchat-otr/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,13 @@ Package.describe({
});

Package.onUse(function(api) {

api.use([
'ecmascript',
'rocketchat:lib',
'tracker',
'reactive-var',
'templating',
]);

api.use('templating', 'client');

api.addFiles([
'client/rocketchat.otr.js',
'client/rocketchat.otr.room.js',
'client/stylesheets/otr.css',
'client/views/otrFlexTab.html',
'client/views/otrFlexTab.js',
'client/tabBar.js',
], 'client');

api.addFiles([
'server/settings.js',
'server/models/Messages.js',
'server/methods/deleteOldOTRMessages.js',
'server/methods/updateOTRAck.js',
], 'server');
api.mainModule('client/index.js', 'client');
api.mainModule('server/index.js', 'server');
});
4 changes: 4 additions & 0 deletions packages/rocketchat-otr/server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './settings';
import './models/Messages';
import './methods/deleteOldOTRMessages';
import './methods/updateOTRAck';
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';

Meteor.methods({
deleteOldOTRMessages(roomId) {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-otr/server/methods/updateOTRAck.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';

Meteor.methods({
updateOTRAck(_id, ack) {
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-otr/server/models/Messages.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { RocketChat } from 'meteor/rocketchat:lib';

RocketChat.models.Messages.deleteOldOTRMessages = function(roomId, ts) {
const query = { rid: roomId, t: 'otr', ts: { $lte: ts } };
return this.remove(query);
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-otr/server/settings.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { RocketChat } from 'meteor/rocketchat:lib';

RocketChat.settings.addGroup('OTR', function() {
this.add('OTR_Enable', true, {
type: 'boolean',
Expand Down

0 comments on commit a777718

Please sign in to comment.