1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-31 22:54:11 +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 trashUrl = siteRoot + 'repo/recycle/' + repoID + '/?referer=' + encodeURIComponent(location.href);
let historyUrl = siteRoot + 'repo/history/' + repoID + '/';
if ( (name === repoName || name === '') && !isFile && permission) {
return (
<Fragment>
if (permission) {
if (isFile) { // isFile
historyUrl = siteRoot + 'repo/file_revisions/' + repoID + '/?p=' + Utils.encodePath(currentPath);
return (
<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>
</ul>
{this.state.isRepoTagDialogShow && (
<ModalPortal>
<Modal isOpen={true}>
{this.state.isListRepoTagShow && (
<ListTagDialog
repoID={repoID}
onListTagCancel={this.onCloseRepoTagDialog}
onCreateRepoTag={this.onCreateRepoTagToggle}
onUpdateRepoTag={this.onUpdateRepoTagToggle}
onListTaggedFiles={this.onListTaggedFileToggle}
/>
)}
{this.state.isCreateRepoTagShow && (
<CreateTagDialog
repoID={repoID}
onClose={this.onCloseRepoTagDialog}
toggleCancel={this.onCreateRepoTagToggle}
/>
)}
{this.state.isUpdateRepoTagShow && (
<UpdateTagDialog
repoID={repoID}
currentTag={this.state.currentTag}
onClose={this.onCloseRepoTagDialog}
toggleCancel={this.onUpdateRepoTagToggle}
onDeleteRepoTag={this.props.onDeleteRepoTag}
updateUsedRepoTags={this.props.updateUsedRepoTags}
/>
)}
{this.state.isListTaggedFileShow && (
<ListTaggedFilesDialog
repoID={this.props.repoID}
currentTag={this.state.currentTag}
onClose={this.onCloseRepoTagDialog}
toggleCancel={this.onListTaggedFileToggle}
updateUsedRepoTags={this.props.updateUsedRepoTags}
/>
)}
</Modal>
</ModalPortal>
)}
</Fragment>
);
} else if (!isFile && permission) {
return (
<ul className="path-toolbar">
<li className="toolbar-item"><a className="op-link sf2-icon-recycle" href={trashUrl} title={gettext('Trash')} aria-label={gettext('Trash')}></a></li>
</ul>
);
} else if (permission) {
historyUrl = siteRoot + 'repo/file_revisions/' + repoID + '/?p=' + Utils.encodePath(currentPath);
return (
<ul className="path-toolbar">
<li className="toolbar-item"><a className="op-link sf2-icon-history" href={historyUrl} title={gettext('History')} aria-label={gettext('History')}></a></li>
</ul>
);
);
} else {
if (name) { // name not '' is not root path
trashUrl = siteRoot + 'repo/recycle/' + repoID + '/?dir_path=' + Utils.encodePath(currentPath) + '/?referer=' + encodeURIComponent(location.href);
return (
<ul className="path-toolbar">
<li className="toolbar-item"><a className="op-link sf2-icon-recycle" href={trashUrl} title={gettext('Trash')} aria-label={gettext('Trash')}></a></li>
</ul>
);
} else { // currentPath === '/' is root path
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>
<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>
</ul>
{this.state.isRepoTagDialogShow && (
<ModalPortal>
<Modal isOpen={true}>
{this.state.isListRepoTagShow && (
<ListTagDialog
repoID={repoID}
onListTagCancel={this.onCloseRepoTagDialog}
onCreateRepoTag={this.onCreateRepoTagToggle}
onUpdateRepoTag={this.onUpdateRepoTagToggle}
onListTaggedFiles={this.onListTaggedFileToggle}
/>
)}
{this.state.isCreateRepoTagShow && (
<CreateTagDialog
repoID={repoID}
onClose={this.onCloseRepoTagDialog}
toggleCancel={this.onCreateRepoTagToggle}
/>
)}
{this.state.isUpdateRepoTagShow && (
<UpdateTagDialog
repoID={repoID}
currentTag={this.state.currentTag}
onClose={this.onCloseRepoTagDialog}
toggleCancel={this.onUpdateRepoTagToggle}
onDeleteRepoTag={this.props.onDeleteRepoTag}
updateUsedRepoTags={this.props.updateUsedRepoTags}
/>
)}
{this.state.isListTaggedFileShow && (
<ListTaggedFilesDialog
repoID={this.props.repoID}
currentTag={this.state.currentTag}
onClose={this.onCloseRepoTagDialog}
toggleCancel={this.onListTaggedFileToggle}
updateUsedRepoTags={this.props.updateUsedRepoTags}
/>
)}
</Modal>
</ModalPortal>
)}
</Fragment>
);
}
}
}
return '';
}