summaryrefslogtreecommitdiffstats
path: root/webapp/components/file_upload.jsx
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2017-08-04 14:05:33 -0400
committerChristopher Speller <crspeller@gmail.com>2017-08-04 11:05:33 -0700
commitfb2022fb1cb3c8023efd22316d570d9b26facbd1 (patch)
treed70450ccfc3bfed2d10c6bfcb943ddda164d9882 /webapp/components/file_upload.jsx
parent399865923658319d6d12a7719bc3b5554218bbad (diff)
downloadchat-fb2022fb1cb3c8023efd22316d570d9b26facbd1.tar.gz
chat-fb2022fb1cb3c8023efd22316d570d9b26facbd1.tar.bz2
chat-fb2022fb1cb3c8023efd22316d570d9b26facbd1.zip
PLT-6924 Added ability to disable file uploads/downloads on old mobile apps (#7117)
Diffstat (limited to 'webapp/components/file_upload.jsx')
-rw-r--r--webapp/components/file_upload.jsx11
1 files changed, 6 insertions, 5 deletions
diff --git a/webapp/components/file_upload.jsx b/webapp/components/file_upload.jsx
index 0eb12a097..3e28f11df 100644
--- a/webapp/components/file_upload.jsx
+++ b/webapp/components/file_upload.jsx
@@ -8,6 +8,7 @@ import Constants from 'utils/constants.jsx';
import ChannelStore from 'stores/channel_store.jsx';
import DelayedAction from 'utils/delayed_action.jsx';
import * as UserAgent from 'utils/user_agent.jsx';
+import * as FileUtils from 'utils/file_utils';
import * as Utils from 'utils/utils.jsx';
import {intlShape, injectIntl, defineMessages} from 'react-intl';
@@ -135,7 +136,7 @@ class FileUpload extends React.Component {
}
handleDrop(e) {
- if (global.window.mm_config.EnableFileAttachments === 'false') {
+ if (!FileUtils.canUploadFiles()) {
this.props.onUploadError(Utils.localizeMessage('file_upload.disabled', 'File attachments are disabled.'));
return;
}
@@ -172,7 +173,7 @@ class FileUpload extends React.Component {
});
let dragsterActions = {};
- if (global.window.mm_config.EnableFileAttachments === 'true') {
+ if (FileUtils.canUploadFiles()) {
dragsterActions = {
enter(dragsterEvent, e) {
var files = e.originalEvent.dataTransfer;
@@ -263,7 +264,7 @@ class FileUpload extends React.Component {
// This looks redundant, but must be done this way due to
// setState being an asynchronous call
if (items && items.length > 0) {
- if (global.window.mm_config.EnableFileAttachments === 'false') {
+ if (!FileUtils.canUploadFiles()) {
this.props.onUploadError(Utils.localizeMessage('file_upload.disabled', 'File attachments are disabled.'));
return;
}
@@ -326,7 +327,7 @@ class FileUpload extends React.Component {
if (Utils.cmdOrCtrlPressed(e) && e.keyCode === Constants.KeyCodes.U) {
e.preventDefault();
- if (global.window.mm_config.EnableFileAttachments === 'false') {
+ if (!FileUtils.canUploadFiles()) {
this.props.onUploadError(Utils.localizeMessage('file_upload.disabled', 'File attachments are disabled.'));
return;
}
@@ -377,7 +378,7 @@ class FileUpload extends React.Component {
const uploadsRemaining = Constants.MAX_UPLOAD_FILES - this.props.getFileCount(channelId);
let fileDiv;
- if (global.window.mm_config.EnableFileAttachments === 'true') {
+ if (FileUtils.canUploadFiles()) {
fileDiv = (
<div className='icon--attachment'>
<span