mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 23:20:51 +00:00
Merge pull request #3693 from haiwen/set-folder-permission-bug
Set folder permission bug
This commit is contained in:
@@ -392,6 +392,10 @@ class DirentGridView extends React.Component{
|
|||||||
menuList: menuList,
|
menuList: menuList,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (menuList.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
showMenu(showMenuConfig);
|
showMenu(showMenuConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,11 +412,17 @@ class DirentGridView extends React.Component{
|
|||||||
let contextmenuList = [];
|
let contextmenuList = [];
|
||||||
if (isContextmenu) {
|
if (isContextmenu) {
|
||||||
let { SHARE, DOWNLOAD, DELETE } = TextTranslation;
|
let { SHARE, DOWNLOAD, DELETE } = TextTranslation;
|
||||||
contextmenuList = this.props.showShareBtn ? [SHARE, DOWNLOAD, DELETE, 'Divider'] : [DOWNLOAD, DELETE, 'Divider'];
|
contextmenuList = this.props.showShareBtn ? [SHARE] : [];
|
||||||
|
|
||||||
if (dirent.type === 'file') {
|
if (dirent.permission === 'rw' || dirent.permission === 'r') {
|
||||||
contextmenuList = canGenerateShareLink ? [SHARE, DOWNLOAD, DELETE, 'Divider'] : [DOWNLOAD, DELETE, 'Divider'];
|
contextmenuList = [...contextmenuList, DOWNLOAD];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dirent.permission === 'rw') {
|
||||||
|
contextmenuList = [...contextmenuList, DELETE];
|
||||||
|
}
|
||||||
|
|
||||||
|
contextmenuList = [...contextmenuList, 'Divider'];
|
||||||
}
|
}
|
||||||
|
|
||||||
let { RENAME, MOVE, COPY, PERMISSION, OPEN_VIA_CLIENT, LOCK, UNLOCK, COMMENT, HISTORY, ACCESS_LOG } = TextTranslation;
|
let { RENAME, MOVE, COPY, PERMISSION, OPEN_VIA_CLIENT, LOCK, UNLOCK, COMMENT, HISTORY, ACCESS_LOG } = TextTranslation;
|
||||||
|
@@ -462,7 +462,7 @@ class DirentListItem extends React.Component {
|
|||||||
if (currentRepoInfo.permission === 'cloud-edit' || currentRepoInfo.permission === 'preview') {
|
if (currentRepoInfo.permission === 'cloud-edit' || currentRepoInfo.permission === 'preview') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{selectedDirentList.length > 1 ?
|
{selectedDirentList.length > 1 ?
|
||||||
@@ -470,17 +470,21 @@ class DirentListItem extends React.Component {
|
|||||||
{this.state.isOperationShow && !dirent.isSelected &&
|
{this.state.isOperationShow && !dirent.isSelected &&
|
||||||
<div className="operations">
|
<div className="operations">
|
||||||
<ul className="operation-group">
|
<ul className="operation-group">
|
||||||
<li className="operation-group-item">
|
{(dirent.permission === 'rw' || dirent.permission === 'r') && (
|
||||||
<i className="op-icon sf2-icon-download" title={gettext('Download')} onClick={this.onItemDownload}></i>
|
<li className="operation-group-item">
|
||||||
</li>
|
<i className="op-icon sf2-icon-download" title={gettext('Download')} onClick={this.onItemDownload}></i>
|
||||||
{showShareBtn &&
|
</li>
|
||||||
<li className="operation-group-item">
|
)}
|
||||||
<i className="op-icon sf2-icon-share" title={gettext('Share')} onClick={this.onItemShare}></i>
|
{showShareBtn && (
|
||||||
</li>
|
<li className="operation-group-item">
|
||||||
}
|
<i className="op-icon sf2-icon-share" title={gettext('Share')} onClick={this.onItemShare}></i>
|
||||||
<li className="operation-group-item">
|
</li>
|
||||||
<i className="op-icon sf2-icon-delete" title={gettext('Delete')} onClick={this.onItemDelete}></i>
|
)}
|
||||||
</li>
|
{dirent.permission === 'rw' && (
|
||||||
|
<li className="operation-group-item">
|
||||||
|
<i className="op-icon sf2-icon-delete" title={gettext('Delete')} onClick={this.onItemDelete}></i>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
<li className="operation-group-item">
|
<li className="operation-group-item">
|
||||||
<ItemDropdownMenu
|
<ItemDropdownMenu
|
||||||
item={this.props.dirent}
|
item={this.props.dirent}
|
||||||
@@ -500,17 +504,21 @@ class DirentListItem extends React.Component {
|
|||||||
{this.state.isOperationShow &&
|
{this.state.isOperationShow &&
|
||||||
<div className="operations">
|
<div className="operations">
|
||||||
<ul className="operation-group">
|
<ul className="operation-group">
|
||||||
<li className="operation-group-item">
|
{(dirent.permission === 'rw' || dirent.permission === 'r') && (
|
||||||
<i className="op-icon sf2-icon-download" title={gettext('Download')} onClick={this.onItemDownload}></i>
|
<li className="operation-group-item">
|
||||||
</li>
|
<i className="op-icon sf2-icon-download" title={gettext('Download')} onClick={this.onItemDownload}></i>
|
||||||
{showShareBtn &&
|
</li>
|
||||||
<li className="operation-group-item">
|
)}
|
||||||
<i className="op-icon sf2-icon-share" title={gettext('Share')} onClick={this.onItemShare}></i>
|
{showShareBtn && (
|
||||||
</li>
|
<li className="operation-group-item">
|
||||||
}
|
<i className="op-icon sf2-icon-share" title={gettext('Share')} onClick={this.onItemShare}></i>
|
||||||
<li className="operation-group-item">
|
</li>
|
||||||
<i className="op-icon sf2-icon-delete" title={gettext('Delete')} onClick={this.onItemDelete}></i>
|
)}
|
||||||
</li>
|
{dirent.permission === 'rw' && (
|
||||||
|
<li className="operation-group-item">
|
||||||
|
<i className="op-icon sf2-icon-delete" title={gettext('Delete')} onClick={this.onItemDelete}></i>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
<li className="operation-group-item">
|
<li className="operation-group-item">
|
||||||
<ItemDropdownMenu
|
<ItemDropdownMenu
|
||||||
item={this.props.dirent}
|
item={this.props.dirent}
|
||||||
|
@@ -320,6 +320,10 @@ class DirentListView extends React.Component {
|
|||||||
menuList: menuList,
|
menuList: menuList,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (menuList.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
showMenu(showMenuConfig);
|
showMenu(showMenuConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -467,21 +471,28 @@ class DirentListView extends React.Component {
|
|||||||
|
|
||||||
let menuList = [];
|
let menuList = [];
|
||||||
let contextmenuList = [];
|
let contextmenuList = [];
|
||||||
|
|
||||||
if (isContextmenu) {
|
if (isContextmenu) {
|
||||||
let { SHARE, DOWNLOAD, DELETE } = TextTranslation;
|
let { SHARE, DOWNLOAD, DELETE } = TextTranslation;
|
||||||
contextmenuList = this.props.showShareBtn ? [SHARE, DOWNLOAD, DELETE, 'Divider'] : [DOWNLOAD, DELETE, 'Divider'];
|
contextmenuList = this.props.showShareBtn ? [SHARE] : [];
|
||||||
|
|
||||||
if (dirent.type === 'file') {
|
if (dirent.permission === 'rw' || dirent.permission === 'r') {
|
||||||
contextmenuList = canGenerateShareLink ? [SHARE, DOWNLOAD, DELETE, 'Divider'] : [DOWNLOAD, DELETE, 'Divider'];
|
contextmenuList = [...contextmenuList, DOWNLOAD];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dirent.permission === 'rw') {
|
||||||
|
contextmenuList = [...contextmenuList, DELETE];
|
||||||
|
}
|
||||||
|
|
||||||
|
contextmenuList = [...contextmenuList, 'Divider'];
|
||||||
}
|
}
|
||||||
|
|
||||||
let { RENAME, MOVE, COPY, PERMISSION, OPEN_VIA_CLIENT, LOCK, UNLOCK, COMMENT, HISTORY, ACCESS_LOG, TAGS } = TextTranslation;
|
let { RENAME, MOVE, COPY, PERMISSION, OPEN_VIA_CLIENT, LOCK, UNLOCK, COMMENT, HISTORY, ACCESS_LOG, TAGS } = TextTranslation;
|
||||||
if (type === 'dir' && permission === 'rw') {
|
if (type === 'dir' && permission === 'rw') {
|
||||||
if (can_set_folder_perm) {
|
if (can_set_folder_perm) {
|
||||||
menuList = [...contextmenuList, RENAME, MOVE, COPY, 'Divider', PERMISSION, 'Divider', OPEN_VIA_CLIENT];
|
menuList = [...menuList, RENAME, MOVE, COPY, 'Divider', PERMISSION, 'Divider', OPEN_VIA_CLIENT];
|
||||||
} else {
|
} else {
|
||||||
menuList = [...contextmenuList, RENAME, MOVE, COPY, 'Divider', OPEN_VIA_CLIENT];
|
menuList = [...menuList, RENAME, MOVE, COPY, 'Divider', OPEN_VIA_CLIENT];
|
||||||
}
|
}
|
||||||
return menuList;
|
return menuList;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user