Skip to content

Commit

Permalink
[IMPROVE] Hipchat Enterprise Importer (#12985)
Browse files Browse the repository at this point in the history
* Added message showing the file size limit on the importers

* Importer improvements

* Added missing reference

* Removed globals

* Fixed data importers

* Fixed import

* Removed log

* Changed hipchat enterprise importer to prepare files from the file system

* Use a file URL on the importer

* Avoid duplicated emails

* Prevent duplicated emails from crashing the import process

* Identify errors on the import process

* Fixed attachment import

* Fixed problem with invalid users when creating channels

* Added labels for checkboxes
  • Loading branch information
Hudell authored and rodrigok committed Dec 21, 2018
1 parent 39d8a44 commit 8779fed
Show file tree
Hide file tree
Showing 18 changed files with 685 additions and 237 deletions.
1 change: 1 addition & 0 deletions packages/rocketchat-api/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import './v1/emoji-custom';
import './v1/groups';
import './v1/im';
import './v1/integrations';
import './v1/import';
import './v1/misc';
import './v1/permissions';
import './v1/push';
Expand Down
42 changes: 42 additions & 0 deletions packages/rocketchat-api/server/v1/import.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';

RocketChat.API.v1.addRoute('uploadImportFile', { authRequired: true }, {
post() {
const { binaryContent, contentType, fileName, importerKey } = this.bodyParams;

Meteor.runAsUser(this.userId, () => {
RocketChat.API.v1.success(Meteor.call('uploadImportFile', binaryContent, contentType, fileName, importerKey));
});

return RocketChat.API.v1.success();
},

});

RocketChat.API.v1.addRoute('downloadPublicImportFile', { authRequired: true }, {
post() {
const { fileUrl, importerKey } = this.bodyParams;

Meteor.runAsUser(this.userId, () => {
RocketChat.API.v1.success(Meteor.call('downloadPublicImportFile', fileUrl, importerKey));
});

return RocketChat.API.v1.success();
},

});

RocketChat.API.v1.addRoute('getImportFileData', { authRequired: true }, {
get() {
const { importerKey } = this.requestParams();
let result;
Meteor.runAsUser(this.userId, () => {
result = Meteor.call('getImportFileData', importerKey);
});

return RocketChat.API.v1.success(result);
},

});

8 changes: 7 additions & 1 deletion packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,7 @@
"Duplicate_archived_channel_name": "An archived Channel with name `#%s` exists",
"Duplicate_archived_private_group_name": "An archived Private Group with name '%s' exists",
"Duplicate_channel_name": "A Channel with name '%s' exists",
"Duplicated_Email_address_will_be_ignored": "Duplicated email address will be ignored.",
"Duplicate_private_group_name": "A Private Group with name '%s' exists",
"Duration": "Duration",
"E2E Encryption": "E2E Encryption",
Expand Down Expand Up @@ -1270,6 +1271,9 @@
"FileUpload_Webdav_Proxy_Uploads_Description": "Proxy upload file transmissions through your server instead of direct access to the asset's URL",
"files": "files",
"Files_only": "Only remove the attached files, keep messages",
"FileSize_KB": "__fileSize__ KB",
"FileSize_MB": "__fileSize__ MB",
"FileSize_Bytes": "__fileSize__ Bytes",
"Financial_Services": "Financial Services",
"First_Channel_After_Login": "First Channel After Login",
"First_response_time": "First Response Time",
Expand Down Expand Up @@ -1425,7 +1429,9 @@
"Importer_setup_error": "An error occurred while setting up the importer.",
"Importer_Slack_Users_CSV_Information": "The file uploaded must be Slack's Users export file, which is a CSV file. See here for more information:",
"Importer_Source_File": "Source File Selection",
"Inclusive": "Inclusive",
"Importer_Upload_FileSize_Message": "Your server settings allow the upload of files of any size up to __maxFileSize__.",
"Importer_Upload_Unlimited_FileSize": "Your server settings allow the upload of files of any size.",
"Importer_ExternalUrl_Description": "You can also use an URL for a publicly accessible file:", "Inclusive": "Inclusive",
"Incoming_Livechats": "Incoming Livechats",
"Incoming_WebHook": "Incoming WebHook",
"Industry": "Industry",
Expand Down
Loading

0 comments on commit 8779fed

Please sign in to comment.