diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2017-08-04 14:05:33 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-08-04 11:05:33 -0700 |
commit | fb2022fb1cb3c8023efd22316d570d9b26facbd1 (patch) | |
tree | d70450ccfc3bfed2d10c6bfcb943ddda164d9882 /webapp/components/view_image_popover_bar.jsx | |
parent | 399865923658319d6d12a7719bc3b5554218bbad (diff) | |
download | chat-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/components/view_image_popover_bar.jsx')
-rw-r--r-- | webapp/components/view_image_popover_bar.jsx | 45 |
1 files changed, 26 insertions, 19 deletions
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> ); } |