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

Convert rocketchat-ui-message to main module structure #12871

Merged
merged 5 commits into from
Dec 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion packages/rocketchat-ui-message/client/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
export { renderMessageBody } from './renderMessageBody';
import './message.html';
import './messageBox.html';
import './messageDropdown.html';
import './popup/messagePopup.html';
import './popup/messagePopupChannel.html';
import './popup/messagePopupConfig.html';
import './popup/messagePopupEmoji.html';
import './popup/messagePopupSlashCommand.html';
import './popup/messagePopupSlashCommandPreview.html';
import './popup/messagePopupSlashCommandPreview';
import './popup/messagePopupUser.html';
import './message';
import './messageBox';
import './popup/messagePopup';
import './popup/messagePopupChannel';
import './popup/messagePopupConfig';
import './popup/messagePopupEmoji';
import { renderMessageBody } from './renderMessageBody';
import './startup/messageBoxActions';

export {
renderMessageBody,
};
2 changes: 2 additions & 0 deletions packages/rocketchat-ui-message/client/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import moment from 'moment';
import { DateFormat } from 'meteor/rocketchat:lib';
import { renderEmoji } from 'meteor/rocketchat:emoji';
import { renderMessageBody } from './renderMessageBody';
import { RocketChat } from 'meteor/rocketchat:lib';
import { t } from 'meteor/rocketchat:ui';

async function renderPdfToCanvas(canvasId, pdfLink) {
const isSafari = /constructor/i.test(window.HTMLElement) ||
Expand Down
6 changes: 4 additions & 2 deletions packages/rocketchat-ui-message/client/messageBox.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/* globals fileUpload KonchatNotification chatMessages popover AudioRecorder chatMessages fileUploadHandler*/
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { Tracker } from 'meteor/tracker';
import { Session } from 'meteor/session';
import { Template } from 'meteor/templating';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { fileUploadHandler } from 'meteor/rocketchat:file-upload';
import { t, ChatSubscription, RoomHistoryManager, RoomManager, KonchatNotification, popover, ChatMessages, fileUpload, AudioRecorder, chatMessages } from 'meteor/rocketchat:ui';
import toastr from 'toastr';
import moment from 'moment';
import _ from 'underscore';
Expand Down Expand Up @@ -656,7 +658,7 @@ Template.messageBox.events({
RocketChat.EmojiPicker.close();
} else {
RocketChat.EmojiPicker.open(event.currentTarget, (emoji) => {
const { input } = window.chatMessages[RocketChat.openedRoom];
const { input } = chatMessages[RocketChat.openedRoom];

const emojiValue = `:${ emoji }:`;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Template } from 'meteor/templating';
import { RocketChat } from 'meteor/rocketchat:lib';

Template.messagePopupChannel.helpers({
channelIcon() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { Blaze } from 'meteor/blaze';
import { Session } from 'meteor/session';
import { Template } from 'meteor/templating';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { t } from 'meteor/rocketchat:ui';
import _ from 'underscore';

const usersFromRoomMessages = new Mongo.Collection(null);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* globals toolbarSearch */

/* global toolbarSearch */
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { Session } from 'meteor/session';
import { Template } from 'meteor/templating';
import { RocketChat } from 'meteor/rocketchat:lib';
import _ from 'underscore';

const keys = {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-ui-message/client/renderMessageBody.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RocketChat } from 'meteor/rocketchat:lib';
import s from 'underscore.string';

export const renderMessageBody = (msg) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* globals fileUpload device modal */

/* globals device */
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import mime from 'mime-type/with-db';
import { VRecDialog } from 'meteor/rocketchat:ui-vrecord';
import { RocketChat } from 'meteor/rocketchat:lib';
import { t, modal, fileUpload } from 'meteor/rocketchat:ui';

RocketChat.messageBox.actions.add('Create_new', 'Video_message', {
id: 'video-message',
Expand Down
25 changes: 0 additions & 25 deletions packages/rocketchat-ui-message/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,6 @@ Package.onUse(function(api) {
'rocketchat:ui-account',
'rocketchat:ui-vrecord',
]);

api.addFiles('client/message.html', 'client');
api.addFiles('client/messageBox.html', 'client');
api.addFiles('client/messageDropdown.html', 'client');
api.addFiles('client/popup/messagePopup.html', 'client');
api.addFiles('client/popup/messagePopupChannel.html', 'client');
api.addFiles('client/popup/messagePopupConfig.html', 'client');
api.addFiles('client/popup/messagePopupEmoji.html', 'client');
api.addFiles('client/popup/messagePopupSlashCommand.html', 'client');
api.addFiles('client/popup/messagePopupSlashCommandPreview.html', 'client');
api.addFiles('client/popup/messagePopupSlashCommandPreview.js', 'client');
api.addFiles('client/popup/messagePopupUser.html', 'client');

api.addFiles('client/message.js', 'client');
api.addFiles('client/messageBox.js', 'client');
api.addFiles('client/popup/messagePopup.js', 'client');
api.addFiles('client/popup/messagePopupChannel.js', 'client');
api.addFiles('client/popup/messagePopupConfig.js', 'client');
api.addFiles('client/popup/messagePopupEmoji.js', 'client');

api.addFiles('client/renderMessageBody.js', 'client');

api.addFiles('startup/messageBoxActions.js', 'client');

api.addAssets('../../node_modules/pdfjs-dist/build/pdf.worker.js', 'client');

api.mainModule('client/index.js', 'client');
});
6 changes: 2 additions & 4 deletions packages/rocketchat-ui-sidenav/client/sidebarHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const extendedViewOption = (user) => {
const showToolbar = new ReactiveVar(false);

const selectorSearch = '.toolbar__search .rc-input__element';
const toolbarSearch = {
toolbarSearch = { //eslint-disable-line
shortcut: false,
clear() {
const $inputMessage = $('.js-input-message');
Expand All @@ -63,13 +63,11 @@ const toolbarSearch = {
},
};

this.toolbarSearch = toolbarSearch;

const toolbarButtons = (user) => [{
name: t('Search'),
icon: 'magnifier',
action: () => {
toolbarSearch.show(false);
toolbarSearch.show(false); //eslint-disable-line
},
},
{
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-ui-sidenav/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ Package.onUse(function(api) {
api.addFiles('client/roomList.js', 'client');
api.addFiles('client/sortlist.js', 'client');
api.addFiles('client/toolbar.js', 'client');

api.export('toolbarSearch', 'client');
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* globals Recorder */
this.AudioRecorder = new class {
AudioRecorder = new class { //eslint-disable-line
start(cb) {
window.AudioContext = window.AudioContext || window.webkitAudioContext;

Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-ui/client/views/app/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Clipboard from 'clipboard';

import { lazyloadtick } from 'meteor/rocketchat:lazy-load';

window.chatMessages = window.chatMessages || {};
chatMessages = {}; // eslint-disable-line
const isSubscribed = (_id) => ChatSubscription.find({ rid: _id }).count() > 0;

const favoritesEnabled = () => RocketChat.settings.get('Favorite_Rooms');
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-ui/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,10 @@ Package.onUse(function(api) {
api.export('ChatMessage', 'client');
api.export('RoomHistoryManager', 'client');
api.export('KonchatNotification', 'client');
api.export('AudioRecorder', 'client');
api.export('VideoRecorder', 'client');
api.export('UserRoles', 'client');
api.export('isRtl', 'client');
api.export('alerts', 'client');
api.export('chatMessages', 'client');
});