1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-04 16:31:13 +00:00

repair share link file view bug (#4481)

This commit is contained in:
杨顺强
2020-03-16 11:42:26 +08:00
committed by GitHub
parent 1e66d2ac06
commit 0649f71545

View File

@@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { gettext } from '../../utils/constants'; import { gettext } from '../../utils/constants';
const { err, trafficOverLimit, zipped, filePath } = window.shared.pageOptions; const { err, trafficOverLimit, zipped, filePath, canDownload } = window.shared.pageOptions;
const propTypes = { const propTypes = {
errorMsg: PropTypes.string errorMsg: PropTypes.string
@@ -16,11 +16,14 @@ class SharedFileViewTip extends React.Component {
} else { } else {
errorMsg = <p className="error">{err || this.props.errorMsg}</p>; errorMsg = <p className="error">{err || this.props.errorMsg}</p>;
} }
let isShowDownloadBtn = canDownload && !trafficOverLimit;
return ( return (
<div className="shared-file-view-body"> <div className="shared-file-view-body">
<div className="file-view-tip"> <div className={`file-view-tip ${!isShowDownloadBtn ? 'pt-7' : ''}`}>
{errorMsg} {errorMsg}
{!trafficOverLimit && {isShowDownloadBtn &&
<a href={`?${zipped ? 'p=' + encodeURIComponent(filePath) + '&' : ''}dl=1`} className="btn btn-secondary">{gettext('Download')}</a> <a href={`?${zipped ? 'p=' + encodeURIComponent(filePath) + '&' : ''}dl=1`} className="btn btn-secondary">{gettext('Download')}</a>
} }
</div> </div>