Skip to content

Commit

Permalink
Merge branch 'develop' into meteor-update
Browse files Browse the repository at this point in the history
  • Loading branch information
engelgabriel committed Aug 10, 2017
2 parents b2f8227 + 76b22c2 commit 5cace31
Show file tree
Hide file tree
Showing 72 changed files with 273 additions and 182 deletions.
13 changes: 0 additions & 13 deletions packages/meteor-autocomplete/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,4 @@ Package.onUse(function(api) {
], 'server');

api.export('Autocomplete', 'server');
api.export('AutocompleteTest', {testOnly: true});
});

Package.onTest(function(api) {
api.use('mizzao:autocomplete');

api.use('mongo');
api.use('tinytest');

api.addFiles('tests/rule_tests.coffee', 'client');
api.addFiles('tests/regex_tests.coffee', 'client');
api.addFiles('tests/param_tests.coffee', 'client');
api.addFiles('tests/security_tests.coffee');
});
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/rocketchat-autolinker/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Package.onUse(function(api) {
api.use('ecmascript');
api.use('rocketchat:lib');

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

api.addFiles('settings.js', 'server');
api.addFiles('server/settings.js', 'server');
});
File renamed without changes.
File renamed without changes.
7 changes: 3 additions & 4 deletions packages/rocketchat-cas/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ Package.onUse(function(api) {
api.use('ecmascript');

// Server files
api.add_files('cas_rocketchat.js', 'server');
api.add_files('cas_server.js', 'server');
api.add_files('server/cas_rocketchat.js', 'server');
api.add_files('server/cas_server.js', 'server');

// Client files
api.add_files('cas_client.js', 'client');

api.add_files('client/cas_client.js', 'client');
});

Npm.depends({
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions packages/rocketchat-colors/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Package.onUse(function(api) {
api.use('rocketchat:lib');
api.use('ecmascript');

api.addFiles('client.js', ['client']);
api.addFiles('style.css', ['client']);
api.addFiles('settings.js', ['server']);
api.addFiles('client/client.js', 'client');
api.addFiles('client/style.css', 'client');
api.addFiles('server/settings.js', 'server');
});
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/rocketchat-custom-oauth/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Package.onUse(function(api) {
api.use('http', 'server');


api.mainModule('custom_oauth_client.js', 'client');
api.mainModule('client/custom_oauth_client.js', 'client');

api.mainModule('custom_oauth_server.js', 'server');
api.mainModule('server/custom_oauth_server.js', 'server');

api.export('CustomOAuth');
});
20 changes: 10 additions & 10 deletions packages/rocketchat-custom-sounds/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ Package.onUse(function(api) {

api.addFiles('assets/stylesheets/customSoundsAdmin.less', 'client');

api.addFiles('admin/startup.js', 'client');
api.addFiles('admin/adminSounds.html', 'client');
api.addFiles('admin/adminSounds.js', 'client');
api.addFiles('admin/adminSoundEdit.html', 'client');
api.addFiles('admin/adminSoundInfo.html', 'client');
api.addFiles('admin/soundEdit.html', 'client');
api.addFiles('admin/soundEdit.js', 'client');
api.addFiles('admin/soundInfo.html', 'client');
api.addFiles('admin/soundInfo.js', 'client');
api.addFiles('admin/route.js', 'client');
api.addFiles('client/admin/startup.js', 'client');
api.addFiles('client/admin/adminSounds.html', 'client');
api.addFiles('client/admin/adminSounds.js', 'client');
api.addFiles('client/admin/adminSoundEdit.html', 'client');
api.addFiles('client/admin/adminSoundInfo.html', 'client');
api.addFiles('client/admin/soundEdit.html', 'client');
api.addFiles('client/admin/soundEdit.js', 'client');
api.addFiles('client/admin/soundInfo.html', 'client');
api.addFiles('client/admin/soundInfo.js', 'client');
api.addFiles('client/admin/route.js', 'client');

api.addFiles('client/lib/CustomSounds.js', 'client');
api.addFiles('client/models/CustomSounds.js', 'client');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 11 additions & 11 deletions packages/rocketchat-emoji/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ Package.onUse(function(api) {
'rocketchat:ui-message'
]);

api.addFiles('function-isSet.js', 'client');
api.addFiles('rocketchat.js');
api.addFiles('client/function-isSet.js', 'client');
api.addFiles('client/rocketchat.js');

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

api.addFiles('emojiPicker.html', 'client');
api.addFiles('emojiPicker.js', 'client');
api.addFiles('emojiPicker.less', 'client');
api.addFiles('client/emojiPicker.html', 'client');
api.addFiles('client/emojiPicker.js', 'client');
api.addFiles('client/emojiPicker.less', 'client');

api.addFiles('emoji.css', 'client');
api.addFiles('client/emoji.css', 'client');

api.addFiles('lib/emojiRenderer.js', 'client');
api.addFiles('lib/EmojiPicker.js', 'client');
api.addFiles('emojiButton.js', 'client');
api.addFiles('keyboardFix.js', 'client');
api.addFiles('client/lib/emojiRenderer.js', 'client');
api.addFiles('client/lib/EmojiPicker.js', 'client');
api.addFiles('client/emojiButton.js', 'client');
api.addFiles('client/keyboardFix.js', 'client');

api.export('renderEmoji');
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Meteor.methods({

const attachment = {
title: file.name,
type: 'file',
description: file.description,
title_link: fileUrl,
title_link_download: true
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-highlight-words/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ Package.onUse(function(api) {
'rocketchat:lib'
]);

api.addFiles('client.js', 'client');
api.addFiles('client/client.js', 'client');
});
5 changes: 4 additions & 1 deletion packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,7 @@
"Members_List": "Members List",
"Mentions": "Mentions",
"Mentions_default": "Mentions (default)",
"Mentions_only": "Mentions only",
"Message": "Message",
"Message_AllowBadWordsFilter": "Allow Message bad words filtering",
"Message_AllowDeleting": "Allow Message Deleting",
Expand Down Expand Up @@ -1134,6 +1135,7 @@
"Offline_form_unavailable_message": "Offline form unavailable message",
"Offline_Link_Message": "GO TO MESSAGE",
"Offline_Mention_Email": "You have been mentioned by __user__ in #__room__",
"Offline_Mention_All_Email": "__user__ has posted a message in #__room__",
"Offline_message": "Offline message",
"Offline_success_message": "Offline success message",
"Offline_unavailable": "Offline unavailable",
Expand Down Expand Up @@ -1744,6 +1746,7 @@
"Unnamed": "Unnamed",
"Unpin_Message": "Unpin Message",
"Unread_Count": "Unread Count",
"Unread_Count_DM": "Unread Count for Direct Messages",
"Unread_Tray_Icon_Alert": "Unread Tray Icon Alert",
"Unread_Messages": "Unread Messages",
"Unread_Rooms": "Unread Rooms",
Expand Down Expand Up @@ -1915,4 +1918,4 @@
"your_message_optional": "your message (optional)",
"Your_password_is_wrong": "Your password is wrong!",
"Your_push_was_sent_to_s_devices": "Your push was sent to %s devices"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/rocketchat-importer-csv/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ Package.onUse(function(api) {
});

Npm.depends({
'csv-parse': '1.1.7'
'csv-parse': '1.2.0'
});
61 changes: 57 additions & 4 deletions packages/rocketchat-importer-csv/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,10 @@ Importer.CSV = class ImporterCSV extends Importer.Base {

const selectionUsers = tempUsers.map((u) => new Importer.SelectionUser(u.id, u.username, u.email, false, false, true));
const selectionChannels = tempChannels.map((c) => new Importer.SelectionChannel(c.id, c.name, false, true, c.isPrivate));
const selectionMessages = this.importRecord.count.messages;

super.updateProgress(Importer.ProgressStep.USER_SELECTION);
return new Importer.Selection(this.name, selectionUsers, selectionChannels);
return new Importer.Selection(this.name, selectionUsers, selectionChannels, selectionMessages);
}

startImport(importSelection) {
Expand Down Expand Up @@ -232,16 +233,60 @@ Importer.CSV = class ImporterCSV extends Importer.Base {
}
this.collection.update({ _id: this.channels._id }, { $set: { 'channels': this.channels.channels }});

//If no channels file, collect channel map from DB for message-only import
if (this.channels.channels.length === 0) {
for (const cname of this.messages.keys()) {
Meteor.runAsUser(startedByUserId, () => {
const existantRoom = RocketChat.models.Rooms.findOneByName(cname);
if (existantRoom || cname.toUpperCase() === 'GENERAL') {
this.channels.channels.push({
id: cname.replace('.', '_'),
name: cname,
rocketId: (cname.toUpperCase() === 'GENERAL' ? 'GENERAL' : existantRoom._id),
do_import: true
});
}
});
}
}

//If no users file, collect user map from DB for message-only import
if (this.users.users.length === 0) {
for (const [ch, messagesMap] of this.messages.entries()) {
const csvChannel = this.getChannelFromName(ch);
if (!csvChannel || !csvChannel.do_import) {
continue;
}
Meteor.runAsUser(startedByUserId, () => {
for (const msgs of messagesMap.values()) {
for (const msg of msgs.messages) {
if (!this.getUserFromUsername(msg.username)) {
const user = RocketChat.models.Users.findOneByUsername(msg.username);
if (user) {
this.users.users.push({
rocketId: user._id,
username: user.username
});
}
}
}
}
});
}
}


//Import the Messages
super.updateProgress(Importer.ProgressStep.IMPORTING_MESSAGES);
for (const [ch, messagesMap] of this.messages.entries()) {
const csvChannel = this.getChannelFromName(ch);
if (!csvChannel.do_import) {
if (!csvChannel || !csvChannel.do_import) {
continue;
}

const room = RocketChat.models.Rooms.findOneById(csvChannel.rocketId, { fields: { usernames: 1, t: 1, name: 1 } });
Meteor.runAsUser(startedByUserId, () => {
const timestamps = {};
for (const [msgGroupData, msgs] of messagesMap.entries()) {
super.updateRecord({ 'messagesstatus': `${ ch }/${ msgGroupData }.${ msgs.messages.length }` });
for (const msg of msgs.messages) {
Expand All @@ -253,8 +298,15 @@ Importer.CSV = class ImporterCSV extends Importer.Base {

const creator = this.getUserFromUsername(msg.username);
if (creator) {
let suffix = '';
if (timestamps[msg.ts] === undefined) {
timestamps[msg.ts] = 1;
} else {
suffix = `-${ timestamps[msg.ts] }`;
timestamps[msg.ts] += 1;
}
const msgObj = {
_id: `csv-${ csvChannel.id }-${ msg.ts }`,
_id: `csv-${ csvChannel.id }-${ msg.ts }${ suffix }`,
ts: new Date(parseInt(msg.ts)),
msg: msg.text,
rid: room._id,
Expand Down Expand Up @@ -285,8 +337,9 @@ Importer.CSV = class ImporterCSV extends Importer.Base {
getSelection() {
const selectionUsers = this.users.users.map((u) => new Importer.SelectionUser(u.id, u.username, u.email, false, false, true));
const selectionChannels = this.channels.channels.map((c) => new Importer.SelectionChannel(c.id, c.name, false, true, c.isPrivate));
const selectionMessages = this.importRecord.count.messages;

return new Importer.Selection(this.name, selectionUsers, selectionChannels);
return new Importer.Selection(this.name, selectionUsers, selectionChannels, selectionMessages);
}

getChannelFromName(channelName) {
Expand Down
6 changes: 4 additions & 2 deletions packages/rocketchat-importer-hipchat-enterprise/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,11 @@ Importer.HipChatEnterprise = class ImporterHipChatEnterprise extends Importer.Ba

const selectionUsers = tempUsers.map((u) => new Importer.SelectionUser(u.id, u.username, u.email, u.isDeleted, false, true));
const selectionChannels = tempRooms.map((r) => new Importer.SelectionChannel(r.id, r.name, r.isArchived, true, r.isPrivate));
const selectionMessages = this.importRecord.count.messages;

super.updateProgress(Importer.ProgressStep.USER_SELECTION);

resolve(new Importer.Selection(this.name, selectionUsers, selectionChannels));
resolve(new Importer.Selection(this.name, selectionUsers, selectionChannels, selectionMessages));
}));

//Wish I could make this cleaner :(
Expand Down Expand Up @@ -431,8 +432,9 @@ Importer.HipChatEnterprise = class ImporterHipChatEnterprise extends Importer.Ba
getSelection() {
const selectionUsers = this.users.users.map((u) => new Importer.SelectionUser(u.id, u.username, u.email, false, false, true));
const selectionChannels = this.channels.channels.map((c) => new Importer.SelectionChannel(c.id, c.name, false, true, c.isPrivate));
const selectionMessages = this.importRecord.count.messages;

return new Importer.Selection(this.name, selectionUsers, selectionChannels);
return new Importer.Selection(this.name, selectionUsers, selectionChannels, selectionMessages);
}

getChannelFromRoomIdentifier(roomIdentifier) {
Expand Down
6 changes: 4 additions & 2 deletions packages/rocketchat-importer-hipchat/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ Importer.HipChat = Importer.HipChat = (function() {
const selectionChannels = tempRooms.map(function(room) {
return new Importer.SelectionChannel(room.room_id, room.name, room.is_archived, true, false);
});
const selectionMessages = this.importRecord.count.messages;
this.updateProgress(Importer.ProgressStep.USER_SELECTION);
return new Importer.Selection(this.name, selectionUsers, selectionChannels);
return new Importer.Selection(this.name, selectionUsers, selectionChannels, selectionMessages);
}

startImport(importSelection) {
Expand Down Expand Up @@ -331,7 +332,8 @@ Importer.HipChat = Importer.HipChat = (function() {
const selectionChannels = this.channels.channels.map(function(room) {
return new Importer.SelectionChannel(room.room_id, room.name, room.is_archived, true, false);
});
return new Importer.Selection(this.name, selectionUsers, selectionChannels);
const selectionMessages = this.importRecord.count.messages;
return new Importer.Selection(this.name, selectionUsers, selectionChannels, selectionMessages);
}

}
Expand Down
6 changes: 4 additions & 2 deletions packages/rocketchat-importer-slack/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ Importer.Slack = class extends Importer.Base {
}
const selectionUsers = tempUsers.map(user => new Importer.SelectionUser(user.id, user.name, user.profile.email, user.deleted, user.is_bot, !user.is_bot));
const selectionChannels = tempChannels.map(channel => new Importer.SelectionChannel(channel.id, channel.name, channel.is_archived, true, false));
const selectionMessages = this.importRecord.count.messages;
this.updateProgress(Importer.ProgressStep.USER_SELECTION);
return new Importer.Selection(this.name, selectionUsers, selectionChannels);
return new Importer.Selection(this.name, selectionUsers, selectionChannels, selectionMessages);
}
startImport(importSelection) {
super.startImport(importSelection);
Expand Down Expand Up @@ -431,6 +432,7 @@ Importer.Slack = class extends Importer.Base {
getSelection() {
const selectionUsers = this.users.users.map(user => new Importer.SelectionUser(user.id, user.name, user.profile.email, user.deleted, user.is_bot, !user.is_bot));
const selectionChannels = this.channels.channels.map(channel => new Importer.SelectionChannel(channel.id, channel.name, channel.is_archived, true, false));
return new Importer.Selection(this.name, selectionUsers, selectionChannels);
const selectionMessages = this.importRecord.count.messages;
return new Importer.Selection(this.name, selectionUsers, selectionChannels, selectionMessages);
}
};
Loading

0 comments on commit 5cace31

Please sign in to comment.