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_popover_bar.jsx | 45 ++++++++++++++++------------
 1 file changed, 26 insertions(+), 19 deletions(-)

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

diff --git a/webapp/components/view_image_popover_bar.jsx b/webapp/components/view_image_popover_bar.jsx
index 88055b47b..6a092cbbe 100644
--- a/webapp/components/view_image_popover_bar.jsx
+++ b/webapp/components/view_image_popover_bar.jsx
@@ -1,13 +1,13 @@
 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
 // See License.txt for license information.
 
-import {FormattedMessage} from 'react-intl';
-
 import PropTypes from 'prop-types';
-
 import React from 'react';
+import {FormattedMessage} from 'react-intl';
+
+import * as FileUtils from 'utils/file_utils';
 
-export default class ViewImagePopoverBar extends React.Component {
+export default class ViewImagePopoverBar extends React.PureComponent {
     render() {
         var publicLink = '';
         if (global.window.mm_config.EnablePublicLink === 'true') {
@@ -34,21 +34,9 @@ export default class ViewImagePopoverBar extends React.Component {
             footerClass += ' footer--show';
         }
 
-        return (
-            <div
-                ref='imageFooter'
-                className={footerClass}
-            >
-                <span className='pull-left text'>
-                    <FormattedMessage
-                        id='view_image_popover.file'
-                        defaultMessage='File {count, number} of {total, number}'
-                        values={{
-                            count: (this.props.fileId + 1),
-                            total: this.props.totalFiles
-                        }}
-                    />
-                </span>
+        let downloadLinks = null;
+        if (FileUtils.canDownloadFiles()) {
+            downloadLinks = (
                 <div className='image-links'>
                     {publicLink}
                     <a
@@ -64,6 +52,25 @@ export default class ViewImagePopoverBar extends React.Component {
                         />
                     </a>
                 </div>
+            );
+        }
+
+        return (
+            <div
+                ref='imageFooter'
+                className={footerClass}
+            >
+                <span className='pull-left text'>
+                    <FormattedMessage
+                        id='view_image_popover.file'
+                        defaultMessage='File {count, number} of {total, number}'
+                        values={{
+                            count: (this.props.fileId + 1),
+                            total: this.props.totalFiles
+                        }}
+                    />
+                </span>
+                {downloadLinks}
             </div>
         );
     }
-- 
cgit v1.2.3-1-g7c22

