mirror of
https://github.com/haiwen/seahub.git
synced 2025-07-15 16:04:01 +00:00
When canGenerateShareLink is equal to false delete share
This commit is contained in:
parent
be3f3093a8
commit
17dba3e3c7
@ -1,6 +1,6 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { siteRoot, thumbnailSizeForOriginal, username, isPro, enableFileComment, fileAuditEnabled, folderPermEnabled } from '../../utils/constants';
|
import { siteRoot, thumbnailSizeForOriginal, username, isPro, enableFileComment, fileAuditEnabled, folderPermEnabled, canGenerateShareLink } from '../../utils/constants';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import URLDecorator from '../../utils/url-decorator';
|
import URLDecorator from '../../utils/url-decorator';
|
||||||
@ -412,6 +412,10 @@ class DirentGridView extends React.Component{
|
|||||||
if (isContextmenu) {
|
if (isContextmenu) {
|
||||||
let { SHARE, DOWNLOAD, DELETE } = TextTranslation;
|
let { SHARE, DOWNLOAD, DELETE } = TextTranslation;
|
||||||
contextmenuList = this.props.showShareBtn ? [SHARE, DOWNLOAD, DELETE, 'Divider'] : [DOWNLOAD, DELETE, 'Divider'];
|
contextmenuList = this.props.showShareBtn ? [SHARE, DOWNLOAD, DELETE, 'Divider'] : [DOWNLOAD, DELETE, 'Divider'];
|
||||||
|
|
||||||
|
if (dirent.type === 'file') {
|
||||||
|
contextmenuList = canGenerateShareLink ? [SHARE, DOWNLOAD, DELETE, 'Divider'] : [DOWNLOAD, DELETE, 'Divider']
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let { RENAME, MOVE, COPY, PERMISSION, DETAILS, OPEN_VIA_CLIENT, LOCK, UNLOCK, COMMENT, HISTORY, ACCESS_LOG } = TextTranslation;
|
let { RENAME, MOVE, COPY, PERMISSION, DETAILS, OPEN_VIA_CLIENT, LOCK, UNLOCK, COMMENT, HISTORY, ACCESS_LOG } = TextTranslation;
|
||||||
|
@ -2,7 +2,7 @@ import React, { Fragment } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import MD5 from 'MD5';
|
import MD5 from 'MD5';
|
||||||
import { UncontrolledTooltip } from 'reactstrap';
|
import { UncontrolledTooltip } from 'reactstrap';
|
||||||
import { gettext, siteRoot, mediaUrl, username } from '../../utils/constants';
|
import { gettext, siteRoot, mediaUrl, username, canGenerateShareLink } from '../../utils/constants';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import URLDecorator from '../../utils/url-decorator';
|
import URLDecorator from '../../utils/url-decorator';
|
||||||
@ -413,6 +413,20 @@ class DirentListItem extends React.Component {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let isShowShareBtn = false;
|
||||||
|
|
||||||
|
if (canGenerateShareLink) {
|
||||||
|
isShowShareBtn = true;
|
||||||
|
} else {
|
||||||
|
if (this.props.showShareBtn) {
|
||||||
|
if (dirent.type === 'dir') {
|
||||||
|
isShowShareBtn = true;
|
||||||
|
} else {
|
||||||
|
isShowShareBtn = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{selectedDirentList.length > 1 ?
|
{selectedDirentList.length > 1 ?
|
||||||
@ -423,7 +437,7 @@ class DirentListItem extends React.Component {
|
|||||||
<li className="operation-group-item">
|
<li className="operation-group-item">
|
||||||
<i className="op-icon sf2-icon-download" title={gettext('Download')} onClick={this.onItemDownload}></i>
|
<i className="op-icon sf2-icon-download" title={gettext('Download')} onClick={this.onItemDownload}></i>
|
||||||
</li>
|
</li>
|
||||||
{this.props.showShareBtn &&
|
{this.props.showShareBtn && isShowShareBtn &&
|
||||||
<li className="operation-group-item">
|
<li className="operation-group-item">
|
||||||
<i className="op-icon sf2-icon-share" title={gettext('Share')} onClick={this.onItemShare}></i>
|
<i className="op-icon sf2-icon-share" title={gettext('Share')} onClick={this.onItemShare}></i>
|
||||||
</li>
|
</li>
|
||||||
@ -453,7 +467,7 @@ class DirentListItem extends React.Component {
|
|||||||
<li className="operation-group-item">
|
<li className="operation-group-item">
|
||||||
<i className="op-icon sf2-icon-download" title={gettext('Download')} onClick={this.onItemDownload}></i>
|
<i className="op-icon sf2-icon-download" title={gettext('Download')} onClick={this.onItemDownload}></i>
|
||||||
</li>
|
</li>
|
||||||
{this.props.showShareBtn &&
|
{this.props.showShareBtn && isShowShareBtn &&
|
||||||
<li className="operation-group-item">
|
<li className="operation-group-item">
|
||||||
<i className="op-icon sf2-icon-share" title={gettext('Share')} onClick={this.onItemShare}></i>
|
<i className="op-icon sf2-icon-share" title={gettext('Share')} onClick={this.onItemShare}></i>
|
||||||
</li>
|
</li>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { siteRoot, gettext, thumbnailSizeForOriginal, username, isPro, enableFileComment, fileAuditEnabled, folderPermEnabled } from '../../utils/constants';
|
import { siteRoot, gettext, thumbnailSizeForOriginal, username, isPro, enableFileComment, fileAuditEnabled, folderPermEnabled, canGenerateShareLink } from '../../utils/constants';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import TextTranslation from '../../utils/text-translation';
|
import TextTranslation from '../../utils/text-translation';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
@ -459,6 +459,10 @@ class DirentListView extends React.Component {
|
|||||||
if (isContextmenu) {
|
if (isContextmenu) {
|
||||||
let { SHARE, DOWNLOAD, DELETE } = TextTranslation;
|
let { SHARE, DOWNLOAD, DELETE } = TextTranslation;
|
||||||
contextmenuList = this.props.showShareBtn ? [SHARE, DOWNLOAD, DELETE, 'Divider'] : [DOWNLOAD, DELETE, 'Divider'];
|
contextmenuList = this.props.showShareBtn ? [SHARE, DOWNLOAD, DELETE, 'Divider'] : [DOWNLOAD, DELETE, 'Divider'];
|
||||||
|
|
||||||
|
if (dirent.type === 'file') {
|
||||||
|
contextmenuList = canGenerateShareLink ? [SHARE, DOWNLOAD, DELETE, 'Divider'] : [DOWNLOAD, DELETE, 'Divider']
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let { RENAME, MOVE, COPY, PERMISSION, OPEN_VIA_CLIENT, LOCK, UNLOCK, COMMENT, HISTORY, ACCESS_LOG, TAGS } = TextTranslation;
|
let { RENAME, MOVE, COPY, PERMISSION, OPEN_VIA_CLIENT, LOCK, UNLOCK, COMMENT, HISTORY, ACCESS_LOG, TAGS } = TextTranslation;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { gettext } from '../../utils/constants';
|
import { gettext, canGenerateShareLink } from '../../utils/constants';
|
||||||
import { IconButton, ButtonGroup, CollabUsersButton } from '@seafile/seafile-editor/dist/components/topbarcomponent/editorToolBar';
|
import { IconButton, ButtonGroup, CollabUsersButton } from '@seafile/seafile-editor/dist/components/topbarcomponent/editorToolBar';
|
||||||
import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem, Tooltip } from 'reactstrap';
|
import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem, Tooltip } from 'reactstrap';
|
||||||
import FileInfo from '@seafile/seafile-editor/dist/components/topbarcomponent/file-info';
|
import FileInfo from '@seafile/seafile-editor/dist/components/topbarcomponent/file-info';
|
||||||
@ -141,8 +141,10 @@ class MarkdownViewerToolbar extends React.Component {
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
|
{canGenerateShareLink &&
|
||||||
<IconButton id={'shareBtn'} text={gettext('Share')} icon={'fa fa-share-alt'}
|
<IconButton id={'shareBtn'} text={gettext('Share')} icon={'fa fa-share-alt'}
|
||||||
onMouseDown={this.props.toggleShareLinkDialog}/>
|
onMouseDown={this.props.toggleShareLinkDialog}/>
|
||||||
|
}
|
||||||
<IconButton text={gettext('Back to parent directory')} id={'parentDirectory'}
|
<IconButton text={gettext('Back to parent directory')} id={'parentDirectory'}
|
||||||
icon={'fa fa-folder-open'} onMouseDown={this.props.backToParentDirectory}/>
|
icon={'fa fa-folder-open'} onMouseDown={this.props.backToParentDirectory}/>
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Button, ButtonGroup } from 'reactstrap';
|
import { Button, ButtonGroup } from 'reactstrap';
|
||||||
import { gettext } from '../../utils/constants';
|
import { gettext, canGenerateShareLink } from '../../utils/constants';
|
||||||
import { Utils, isPro } from '../../utils/utils';
|
import { Utils, isPro } from '../../utils/utils';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import URLDecorator from '../../utils/url-decorator';
|
import URLDecorator from '../../utils/url-decorator';
|
||||||
@ -92,13 +92,17 @@ class MutipleDirOperationToolbar extends React.Component {
|
|||||||
|
|
||||||
const { SHARE, TAGS, RELATED_FILES, HISTORY, OPEN_VIA_CLIENT, LOCK, UNLOCK } = TextTranslation;
|
const { SHARE, TAGS, RELATED_FILES, HISTORY, OPEN_VIA_CLIENT, LOCK, UNLOCK } = TextTranslation;
|
||||||
|
|
||||||
|
let shareBtn = currentRepoInfo.encrypted ? [] : [SHARE];
|
||||||
|
|
||||||
if (dirent.type === 'dir') {
|
if (dirent.type === 'dir') {
|
||||||
menuList = [SHARE];
|
menuList = [...shareBtn];
|
||||||
return menuList;
|
return menuList;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirent.type === 'file') {
|
if (dirent.type === 'file') {
|
||||||
menuList = [SHARE, TAGS, RELATED_FILES, 'Divider', HISTORY, 'Divider', OPEN_VIA_CLIENT];
|
shareBtn = canGenerateShareLink ? [SHARE] : [];
|
||||||
|
|
||||||
|
menuList = [...shareBtn, TAGS, RELATED_FILES, 'Divider', HISTORY, 'Divider', OPEN_VIA_CLIENT];
|
||||||
if (!Utils.isMarkdownFile(dirent.name)) {
|
if (!Utils.isMarkdownFile(dirent.name)) {
|
||||||
menuList.splice(2, 1);
|
menuList.splice(2, 1);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import React, { Fragment } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { DropdownToggle, Dropdown, DropdownMenu, DropdownItem, Tooltip} from 'reactstrap';
|
import { DropdownToggle, Dropdown, DropdownMenu, DropdownItem, Tooltip} from 'reactstrap';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import { gettext, siteRoot } from '../../utils/constants';
|
import { gettext, siteRoot, canGenerateShareLink } from '../../utils/constants';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import ModalPotal from '../modal-portal';
|
import ModalPotal from '../modal-portal';
|
||||||
import ShareDialog from '../dialog/share-dialog';
|
import ShareDialog from '../dialog/share-dialog';
|
||||||
@ -88,7 +88,6 @@ class ViewFileToolbar extends React.Component {
|
|||||||
let { filePermission } = this.props;
|
let { filePermission } = this.props;
|
||||||
let name = Utils.getFileName(this.props.path);
|
let name = Utils.getFileName(this.props.path);
|
||||||
let dirent = { name: name };
|
let dirent = { name: name };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<div className="dir-operation">
|
<div className="dir-operation">
|
||||||
@ -109,7 +108,9 @@ class ViewFileToolbar extends React.Component {
|
|||||||
{gettext('More')}
|
{gettext('More')}
|
||||||
</DropdownToggle>
|
</DropdownToggle>
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
|
{canGenerateShareLink &&
|
||||||
<DropdownItem onClick={this.onShareToggle}>{gettext('Share')}</DropdownItem>
|
<DropdownItem onClick={this.onShareToggle}>{gettext('Share')}</DropdownItem>
|
||||||
|
}
|
||||||
<DropdownItem onClick={this.onEditFileTagToggle}>{gettext('Tags')}</DropdownItem>
|
<DropdownItem onClick={this.onEditFileTagToggle}>{gettext('Tags')}</DropdownItem>
|
||||||
<DropdownItem onClick={this.onListRelatedFileToggle}>{gettext('Related Files')}</DropdownItem>
|
<DropdownItem onClick={this.onListRelatedFileToggle}>{gettext('Related Files')}</DropdownItem>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
|
Loading…
Reference in New Issue
Block a user