summaryrefslogtreecommitdiffstats
path: root/webapp/utils
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/utils
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/utils')
-rw-r--r--webapp/utils/file_utils.jsx24
1 files changed, 24 insertions, 0 deletions
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;
+}