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