1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-06 17:33:18 +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,7 +86,23 @@ 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) {
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-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">
@@ -107,7 +123,6 @@ class DirTool extends React.Component {
onListTaggedFiles={this.onListTaggedFileToggle}
/>
)}
{this.state.isCreateRepoTagShow && (
<CreateTagDialog
repoID={repoID}
@@ -115,7 +130,6 @@ class DirTool extends React.Component {
toggleCancel={this.onCreateRepoTagToggle}
/>
)}
{this.state.isUpdateRepoTagShow && (
<UpdateTagDialog
repoID={repoID}
@@ -126,7 +140,6 @@ class DirTool extends React.Component {
updateUsedRepoTags={this.props.updateUsedRepoTags}
/>
)}
{this.state.isListTaggedFileShow && (
<ListTaggedFilesDialog
repoID={this.props.repoID}
@@ -141,19 +154,8 @@ class DirTool extends React.Component {
)}
</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>
);
}
}
}
return '';
}