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)

---
 webapp/utils/file_utils.jsx | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 webapp/utils/file_utils.jsx

(limited to 'webapp/utils/file_utils.jsx')

diff --git a/webapp/utils/file_utils.jsx b/webapp/utils/file_utils.jsx
new file mode 100644
index 000000000..42feb11be
--- /dev/null
+++ b/webapp/utils/file_utils.jsx
@@ -0,0 +1,24 @@
+// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import * as UserAgent from 'utils/user_agent';
+
+export function canUploadFiles() {
+    if (window.mm_config.EnableFileAttachments === 'false') {
+        return false;
+    }
+
+    if (UserAgent.isMobileApp() && window.mm_license.IsLicensed === 'true' && window.mm_license.Compliance === 'true') {
+        return window.mm_config.EnableMobileFileUpload !== 'false';
+    }
+
+    return true;
+}
+
+export function canDownloadFiles() {
+    if (UserAgent.isMobileApp() && window.mm_license.IsLicensed === 'true' && window.mm_license.Compliance === 'true') {
+        return window.mm_config.EnableMobileFileDownload !== 'false';
+    }
+
+    return true;
+}
-- 
cgit v1.2.3-1-g7c22

