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/components/view_image.jsx | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

(limited to 'webapp/components/view_image.jsx')

diff --git a/webapp/components/view_image.jsx b/webapp/components/view_image.jsx
index 237d0a6dc..4350711fc 100644
--- a/webapp/components/view_image.jsx
+++ b/webapp/components/view_image.jsx
@@ -1,24 +1,25 @@
 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
 // See License.txt for license information.
 
-import AudioVideoPreview from './audio_video_preview.jsx';
-import CodePreview from './code_preview.jsx';
-import PDFPreview from './pdf_preview.jsx';
-import FileInfoPreview from './file_info_preview.jsx';
-import ViewImagePopoverBar from './view_image_popover_bar.jsx';
+import $ from 'jquery';
+import PropTypes from 'prop-types';
+import React from 'react';
+import {Modal} from 'react-bootstrap';
 
 import * as GlobalActions from 'actions/global_actions.jsx';
 
+import * as FileUtils from 'utils/file_utils';
 import * as Utils from 'utils/utils.jsx';
-import {getFileUrl, getFilePreviewUrl} from 'mattermost-redux/utils/file_utils';
 
-import Constants from 'utils/constants.jsx';
-const KeyCodes = Constants.KeyCodes;
+import {KeyCodes} from 'utils/constants.jsx';
 
-import $ from 'jquery';
-import PropTypes from 'prop-types';
-import React from 'react';
-import {Modal} from 'react-bootstrap';
+import {getFileUrl, getFilePreviewUrl} from 'mattermost-redux/utils/file_utils';
+
+import AudioVideoPreview from './audio_video_preview.jsx';
+import CodePreview from './code_preview.jsx';
+import FileInfoPreview from './file_info_preview.jsx';
+import PDFPreview from './pdf_preview.jsx';
+import ViewImagePopoverBar from './view_image_popover_bar.jsx';
 
 import loadingGif from 'images/load.gif';
 
@@ -350,6 +351,10 @@ function ImagePreview({fileInfo, fileUrl}) {
         previewUrl = fileUrl;
     }
 
+    if (!FileUtils.canDownloadFiles()) {
+        return <img src={previewUrl}/>;
+    }
+
     return (
         <a
             href={fileUrl}
-- 
cgit v1.2.3-1-g7c22

