1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-17 07:41:26 +00:00

Merge branch '7.1'

Conflicts:
	frontend/src/pages/search/advanced-search.js
This commit is contained in:
llj
2020-07-22 10:59:53 +08:00
58 changed files with 743 additions and 690 deletions

View File

@@ -32,7 +32,7 @@ class AboutDialog extends React.Component {
<button type="button" className="close" onClick={this.toggle}><span aria-hidden="true">×</span></button>
<div className="about-content">
<p><img src={mediaUrl + logoPath} height={logoHeight} width={logoWidth} title={siteTitle} alt="logo" /></p>
<p>{gettext('Server Version: ')}{seafileVersion}<br />© 2019 {gettext('Seafile')}</p>
<p>{gettext('Server Version: ')}{seafileVersion}<br />© 2020 {gettext('Seafile')}</p>
<p>{this.renderExternalAboutLinks()}</p>
<p><a href={href} target="_blank">{gettext('About Us')}</a></p>
</div>

View File

@@ -12,16 +12,26 @@ const propTypes = {
class DeleteRepoDialog extends Component {
constructor(props) {
super(props);
this.state = {
isRequestSended: false,
};
}
toggle = () => {
this.props.toggle();
}
onDeleteRepo = () => {
this.props.onDeleteRepo(this.props.repo);
this.setState({isRequestSended: true}, () => {
this.props.onDeleteRepo(this.props.repo);
});
}
render() {
const { isRequestSended } = this.state;
const repo = this.props.repo;
const repoName = '<span class="op-target">' + Utils.HTMLescape(repo.repo_name || repo.name) + '</span>';
let message = gettext('Are you sure you want to delete %s ?');
@@ -35,7 +45,7 @@ class DeleteRepoDialog extends Component {
</ModalBody>
<ModalFooter>
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
<Button color="primary" onClick={this.onDeleteRepo}>{gettext('Delete')}</Button>
<Button color="primary" disabled={isRequestSended} onClick={this.onDeleteRepo}>{gettext('Delete')}</Button>
</ModalFooter>
</Modal>
);

View File

@@ -51,14 +51,22 @@ class ShareDialog extends React.Component {
}
getInitialActiveTab = () => {
const { repoEncrypted, userPerm, enableDirPrivateShare } = this.props;
let { repoEncrypted, userPerm, enableDirPrivateShare, itemType } = this.props;
const enableShareLink = !repoEncrypted && canGenerateShareLink;
const enableUploadLink = !repoEncrypted && canGenerateUploadLink && userPerm == 'rw';
// for encrypted repo, 'dir private share' is only enabled for the repo itself,
// not for the folders in it.
if (repoEncrypted) {
enableDirPrivateShare = itemType == 'library';
}
if (enableShareLink) {
return 'shareLink';
} else if (enableUploadLink) {
return 'uploadLink';
} else if (itemType == 'file' || itemType == 'dir') {
return 'internalLink';
} else if (enableDirPrivateShare) {
return 'shareToUser';
}
@@ -77,10 +85,16 @@ class ShareDialog extends React.Component {
}
let activeTab = this.state.activeTab;
const { repoEncrypted, userPerm, enableDirPrivateShare, itemType } = this.props;
let { repoEncrypted, userPerm, enableDirPrivateShare, itemType } = this.props;
const enableShareLink = !repoEncrypted && canGenerateShareLink;
const enableUploadLink = !repoEncrypted && canGenerateUploadLink && userPerm == 'rw';
// for encrypted repo, 'dir private share' is only enabled for the repo itself,
// not for the folders in it.
if (repoEncrypted) {
enableDirPrivateShare = itemType == 'library';
}
return (
<Fragment>
<div className="share-dialog-side">
@@ -184,17 +198,20 @@ class ShareDialog extends React.Component {
renderFileContent = () => {
let activeTab = this.state.activeTab;
const { itemType } = this.props;
const { itemType, itemName, repoEncrypted } = this.props;
const enableShareLink = !repoEncrypted && canGenerateShareLink;
return (
<Fragment>
<div className="share-dialog-side">
<Nav pills>
{enableShareLink &&
<NavItem>
<NavLink className={activeTab === 'shareLink' ? 'active' : ''} onClick={(this.toggle.bind(this, 'shareLink'))}>
{gettext('Share Link')}
</NavLink>
</NavItem>
}
<NavItem>
<NavLink className={activeTab === 'internalLink' ? 'active' : ''} onClick={this.toggle.bind(this, 'internalLink')}>
{gettext('Internal Link')}
@@ -204,7 +221,7 @@ class ShareDialog extends React.Component {
</div>
<div className="share-dialog-main">
<TabContent activeTab={this.state.activeTab}>
{activeTab === 'shareLink' &&
{enableShareLink && activeTab === 'shareLink' &&
<TabPane tabId="shareLink">
<GenerateShareLink
itemPath={this.props.itemPath}
@@ -239,8 +256,7 @@ class ShareDialog extends React.Component {
}
render() {
const { itemType, itemName, repoEncrypted } = this.props;
const enableShareLink = !repoEncrypted && canGenerateShareLink;
const { itemType, itemName } = this.props;
return (
<div>
<Modal isOpen={true} style={{maxWidth: '760px'}} className="share-dialog" toggle={this.props.toggleDialog}>
@@ -250,7 +266,7 @@ class ShareDialog extends React.Component {
</ModalHeader>
<ModalBody className="share-dialog-content">
{(itemType === 'library' || itemType === 'dir') && this.renderDirContent()}
{(itemType === 'file' && enableShareLink) && this.renderFileContent()}
{itemType === 'file' && this.renderFileContent()}
</ModalBody>
</Modal>
</div>

View File

@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { gettext, siteRoot } from '../../utils/constants';
import { gettext } from '../../utils/constants';
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { seafileAPI } from '../../utils/seafile-api';
import moment from 'moment';
@@ -9,7 +9,7 @@ import { Utils } from '../../utils/utils';
const propTypes = {
toggleCancel: PropTypes.func.isRequired,
addWiki: PropTypes.func.isRequired,
addWiki: PropTypes.func.isRequired
};
class WikiSelectDialog extends React.Component {
@@ -24,10 +24,26 @@ class WikiSelectDialog extends React.Component {
componentDidMount() {
seafileAPI.listRepos().then(res => {
let repoList = res.data.repos.map(item => {
let repo = new Repo(item);
return repo;
});
let repoList = res.data.repos
.filter(item => {
switch (item.type) {
case 'mine': // my libraries
return !item.encrypted;
case 'shared': // libraries shared with me
// 'is_admin': the library is shared with 'admin' permission
return !item.encrypted && item.is_admin;
case 'group':
default:
return !item.encrypted && !res.data.repos.some(repo => {
// just remove the duplicated libraries
return repo.type != item.type && repo.repo_id == item.repo_id;
});
}
})
.map(item => {
let repo = new Repo(item);
return repo;
});
repoList = Utils.sortRepos(repoList, 'name', 'asc');
this.setState({repos: repoList});
});