mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-15 06:44:16 +00:00
When canGenerateShareLink is equal to false delete share
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
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 { Dropdown, DropdownToggle, DropdownMenu, DropdownItem, Tooltip } from 'reactstrap';
|
||||
import FileInfo from '@seafile/seafile-editor/dist/components/topbarcomponent/file-info';
|
||||
@@ -141,8 +141,10 @@ class MarkdownViewerToolbar extends React.Component {
|
||||
/>
|
||||
}
|
||||
<ButtonGroup>
|
||||
<IconButton id={'shareBtn'} text={gettext('Share')} icon={'fa fa-share-alt'}
|
||||
{canGenerateShareLink &&
|
||||
<IconButton id={'shareBtn'} text={gettext('Share')} icon={'fa fa-share-alt'}
|
||||
onMouseDown={this.props.toggleShareLinkDialog}/>
|
||||
}
|
||||
<IconButton text={gettext('Back to parent directory')} id={'parentDirectory'}
|
||||
icon={'fa fa-folder-open'} onMouseDown={this.props.backToParentDirectory}/>
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import React, { Fragment } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button, ButtonGroup } from 'reactstrap';
|
||||
import { gettext } from '../../utils/constants';
|
||||
import { gettext, canGenerateShareLink } from '../../utils/constants';
|
||||
import { Utils, isPro } from '../../utils/utils';
|
||||
import { seafileAPI } from '../../utils/seafile-api';
|
||||
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;
|
||||
|
||||
let shareBtn = currentRepoInfo.encrypted ? [] : [SHARE];
|
||||
|
||||
if (dirent.type === 'dir') {
|
||||
menuList = [SHARE];
|
||||
menuList = [...shareBtn];
|
||||
return menuList;
|
||||
}
|
||||
|
||||
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)) {
|
||||
menuList.splice(2, 1);
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ import React, { Fragment } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { DropdownToggle, Dropdown, DropdownMenu, DropdownItem, Tooltip} from 'reactstrap';
|
||||
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 ModalPotal from '../modal-portal';
|
||||
import ShareDialog from '../dialog/share-dialog';
|
||||
@@ -88,7 +88,6 @@ class ViewFileToolbar extends React.Component {
|
||||
let { filePermission } = this.props;
|
||||
let name = Utils.getFileName(this.props.path);
|
||||
let dirent = { name: name };
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<div className="dir-operation">
|
||||
@@ -109,7 +108,9 @@ class ViewFileToolbar extends React.Component {
|
||||
{gettext('More')}
|
||||
</DropdownToggle>
|
||||
<DropdownMenu>
|
||||
<DropdownItem onClick={this.onShareToggle}>{gettext('Share')}</DropdownItem>
|
||||
{canGenerateShareLink &&
|
||||
<DropdownItem onClick={this.onShareToggle}>{gettext('Share')}</DropdownItem>
|
||||
}
|
||||
<DropdownItem onClick={this.onEditFileTagToggle}>{gettext('Tags')}</DropdownItem>
|
||||
<DropdownItem onClick={this.onListRelatedFileToggle}>{gettext('Related Files')}</DropdownItem>
|
||||
</DropdownMenu>
|
||||
|
Reference in New Issue
Block a user