From fb2022fb1cb3c8023efd22316d570d9b26facbd1 Mon Sep 17 00:00:00 2001
From: Harrison Healey <harrisonmhealey@gmail.com>
Date: Fri, 4 Aug 2017 14:05:33 -0400
Subject: PLT-6924 Added ability to disable file uploads/downloads on old
 mobile apps (#7117)

---
 .../components/admin_console/storage_settings.jsx  | 84 ++++++++++++----------
 1 file changed, 48 insertions(+), 36 deletions(-)

(limited to 'webapp/components/admin_console/storage_settings.jsx')

diff --git a/webapp/components/admin_console/storage_settings.jsx b/webapp/components/admin_console/storage_settings.jsx
index 934a82f8f..4e0d9d19b 100644
--- a/webapp/components/admin_console/storage_settings.jsx
+++ b/webapp/components/admin_console/storage_settings.jsx
@@ -66,6 +66,53 @@ export default class StorageSettings extends AdminSettings {
     }
 
     renderSettings() {
+        const mobileUploadDownloadSettings = [];
+        if (window.mm_license.IsLicensed === 'true' && window.mm_license.Compliance === 'true') {
+            mobileUploadDownloadSettings.push(
+                <BooleanSetting
+                    key='enableMobileUpload'
+                    id='enableMobileUpload'
+                    label={
+                        <FormattedMessage
+                            id='admin.file.enableMobileUploadTitle'
+                            defaultMessage='Allow File Uploads on Mobile:'
+                        />
+                    }
+                    helpText={
+                        <FormattedMessage
+                            id='admin.file.enableMobileUploadDesc'
+                            defaultMessage='When false, disables file uploads on mobile apps. If Allow File Sharing is set to true, users can still upload files from a mobile web browser.'
+                        />
+                    }
+                    value={this.state.enableMobileUpload}
+                    onChange={this.handleChange}
+                    disabled={!this.state.enableFileAttachments}
+                />
+            );
+
+            mobileUploadDownloadSettings.push(
+                <BooleanSetting
+                    key='enableMobileDownload'
+                    id='enableMobileDownload'
+                    label={
+                        <FormattedMessage
+                            id='admin.file.enableMobileDownloadTitle'
+                            defaultMessage='Allow File Downloads on Mobile:'
+                        />
+                    }
+                    helpText={
+                        <FormattedMessage
+                            id='admin.file.enableMobileDownloadDesc'
+                            defaultMessage='When false, disables file downloads on mobile apps. Users can still download files from a mobile web browser.'
+                        />
+                    }
+                    value={this.state.enableMobileDownload}
+                    onChange={this.handleChange}
+                    disabled={!this.state.enableFileAttachments}
+                />
+            );
+        }
+
         return (
             <SettingsGroup>
                 <DropdownSetting
@@ -222,42 +269,7 @@ export default class StorageSettings extends AdminSettings {
                     value={this.state.enableFileAttachments}
                     onChange={this.handleChange}
                 />
-                <BooleanSetting
-                    id='enableMobileUpload'
-                    label={
-                        <FormattedMessage
-                            id='admin.file.enableMobileUploadTitle'
-                            defaultMessage='Allow File Uploads on Mobile:'
-                        />
-                    }
-                    helpText={
-                        <FormattedMessage
-                            id='admin.file.enableMobileUploadDesc'
-                            defaultMessage='When false, disables file uploads on mobile apps. If Allow File Sharing is set to true, users can still upload files from a mobile web browser.'
-                        />
-                    }
-                    value={this.state.enableMobileUpload}
-                    onChange={this.handleChange}
-                    disabled={!this.state.enableFileAttachments}
-                />
-                <BooleanSetting
-                    id='enableMobileDownload'
-                    label={
-                        <FormattedMessage
-                            id='admin.file.enableMobileDownloadTitle'
-                            defaultMessage='Allow File Downloads on Mobile:'
-                        />
-                    }
-                    helpText={
-                        <FormattedMessage
-                            id='admin.file.enableMobileDownloadDesc'
-                            defaultMessage='When false, disables file downloads on mobile apps. Users can still download files from a mobile web browser.'
-                        />
-                    }
-                    value={this.state.enableMobileDownload}
-                    onChange={this.handleChange}
-                    disabled={!this.state.enableFileAttachments}
-                />
+                {mobileUploadDownloadSettings}
                 <TextSetting
                     id='maxFileSize'
                     label={
-- 
cgit v1.2.3-1-g7c22

