1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-08 10:22:46 +00:00

repair dir trash bug

This commit is contained in:
shanshuirenjia
2019-05-29 18:44:38 +08:00
parent 6719b0a7af
commit 233a0f1629

View File

@@ -86,74 +86,76 @@ class DirTool extends React.Component {
let name = Utils.getFileName(currentPath); let name = Utils.getFileName(currentPath);
let trashUrl = siteRoot + 'repo/recycle/' + repoID + '/?referer=' + encodeURIComponent(location.href); let trashUrl = siteRoot + 'repo/recycle/' + repoID + '/?referer=' + encodeURIComponent(location.href);
let historyUrl = siteRoot + 'repo/history/' + repoID + '/'; let historyUrl = siteRoot + 'repo/history/' + repoID + '/';
if ( (name === repoName || name === '') && !isFile && permission) { if (permission) {
return ( if (isFile) { // isFile
<Fragment> historyUrl = siteRoot + 'repo/file_revisions/' + repoID + '/?p=' + Utils.encodePath(currentPath);
return (
<ul className="path-toolbar"> <ul className="path-toolbar">
<li className="toolbar-item"><a className="op-link sf2-icon-tag" onClick={this.onShowListRepoTag} title={gettext('Tags')} aria-label={gettext('Tags')}></a></li>
<li className="toolbar-item"><a className="op-link sf2-icon-recycle" href={trashUrl} title={gettext('Trash')} aria-label={gettext('Trash')}></a></li>
<li className="toolbar-item"><a className="op-link sf2-icon-history" href={historyUrl} title={gettext('History')} aria-label={gettext('History')}></a></li> <li className="toolbar-item"><a className="op-link sf2-icon-history" href={historyUrl} title={gettext('History')} aria-label={gettext('History')}></a></li>
</ul> </ul>
);
{this.state.isRepoTagDialogShow && ( } else {
<ModalPortal> if (name) { // name not '' is not root path
<Modal isOpen={true}> trashUrl = siteRoot + 'repo/recycle/' + repoID + '/?dir_path=' + Utils.encodePath(currentPath) + '/?referer=' + encodeURIComponent(location.href);
{this.state.isListRepoTagShow && ( return (
<ListTagDialog <ul className="path-toolbar">
repoID={repoID} <li className="toolbar-item"><a className="op-link sf2-icon-recycle" href={trashUrl} title={gettext('Trash')} aria-label={gettext('Trash')}></a></li>
onListTagCancel={this.onCloseRepoTagDialog} </ul>
onCreateRepoTag={this.onCreateRepoTagToggle} );
onUpdateRepoTag={this.onUpdateRepoTagToggle} } else { // currentPath === '/' is root path
onListTaggedFiles={this.onListTaggedFileToggle} return (
/> <Fragment>
)} <ul className="path-toolbar">
<li className="toolbar-item"><a className="op-link sf2-icon-tag" onClick={this.onShowListRepoTag} title={gettext('Tags')} aria-label={gettext('Tags')}></a></li>
{this.state.isCreateRepoTagShow && ( <li className="toolbar-item"><a className="op-link sf2-icon-recycle" href={trashUrl} title={gettext('Trash')} aria-label={gettext('Trash')}></a></li>
<CreateTagDialog <li className="toolbar-item"><a className="op-link sf2-icon-history" href={historyUrl} title={gettext('History')} aria-label={gettext('History')}></a></li>
repoID={repoID} </ul>
onClose={this.onCloseRepoTagDialog}
toggleCancel={this.onCreateRepoTagToggle} {this.state.isRepoTagDialogShow && (
/> <ModalPortal>
)} <Modal isOpen={true}>
{this.state.isListRepoTagShow && (
{this.state.isUpdateRepoTagShow && ( <ListTagDialog
<UpdateTagDialog repoID={repoID}
repoID={repoID} onListTagCancel={this.onCloseRepoTagDialog}
currentTag={this.state.currentTag} onCreateRepoTag={this.onCreateRepoTagToggle}
onClose={this.onCloseRepoTagDialog} onUpdateRepoTag={this.onUpdateRepoTagToggle}
toggleCancel={this.onUpdateRepoTagToggle} onListTaggedFiles={this.onListTaggedFileToggle}
onDeleteRepoTag={this.props.onDeleteRepoTag} />
updateUsedRepoTags={this.props.updateUsedRepoTags} )}
/> {this.state.isCreateRepoTagShow && (
)} <CreateTagDialog
repoID={repoID}
{this.state.isListTaggedFileShow && ( onClose={this.onCloseRepoTagDialog}
<ListTaggedFilesDialog toggleCancel={this.onCreateRepoTagToggle}
repoID={this.props.repoID} />
currentTag={this.state.currentTag} )}
onClose={this.onCloseRepoTagDialog} {this.state.isUpdateRepoTagShow && (
toggleCancel={this.onListTaggedFileToggle} <UpdateTagDialog
updateUsedRepoTags={this.props.updateUsedRepoTags} repoID={repoID}
/> currentTag={this.state.currentTag}
)} onClose={this.onCloseRepoTagDialog}
</Modal> toggleCancel={this.onUpdateRepoTagToggle}
</ModalPortal> onDeleteRepoTag={this.props.onDeleteRepoTag}
)} updateUsedRepoTags={this.props.updateUsedRepoTags}
</Fragment> />
); )}
} else if (!isFile && permission) { {this.state.isListTaggedFileShow && (
return ( <ListTaggedFilesDialog
<ul className="path-toolbar"> repoID={this.props.repoID}
<li className="toolbar-item"><a className="op-link sf2-icon-recycle" href={trashUrl} title={gettext('Trash')} aria-label={gettext('Trash')}></a></li> currentTag={this.state.currentTag}
</ul> onClose={this.onCloseRepoTagDialog}
); toggleCancel={this.onListTaggedFileToggle}
} else if (permission) { updateUsedRepoTags={this.props.updateUsedRepoTags}
historyUrl = siteRoot + 'repo/file_revisions/' + repoID + '/?p=' + Utils.encodePath(currentPath); />
return ( )}
<ul className="path-toolbar"> </Modal>
<li className="toolbar-item"><a className="op-link sf2-icon-history" href={historyUrl} title={gettext('History')} aria-label={gettext('History')}></a></li> </ModalPortal>
</ul> )}
); </Fragment>
);
}
}
} }
return ''; return '';
} }