mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 07:55:36 +00:00
repair share btn control bug
This commit is contained in:
@@ -46,7 +46,6 @@ const propTypes = {
|
||||
// list
|
||||
isDirentListLoading: PropTypes.bool.isRequired,
|
||||
direntList: PropTypes.array.isRequired,
|
||||
showShareBtn: PropTypes.bool.isRequired,
|
||||
sortBy: PropTypes.string.isRequired,
|
||||
sortOrder: PropTypes.string.isRequired,
|
||||
sortItems: PropTypes.func.isRequired,
|
||||
@@ -205,7 +204,6 @@ class DirColumnView extends React.Component {
|
||||
updateUsedRepoTags={this.props.updateUsedRepoTags}
|
||||
isDirentListLoading={this.props.isDirentListLoading}
|
||||
direntList={this.props.direntList}
|
||||
showShareBtn={this.props.showShareBtn}
|
||||
sortBy={this.props.sortBy}
|
||||
sortOrder={this.props.sortOrder}
|
||||
sortItems={this.props.sortItems}
|
||||
|
@@ -26,7 +26,6 @@ const propTypes = {
|
||||
isDirentDetailShow: PropTypes.bool.isRequired,
|
||||
enableDirPrivateShare: PropTypes.bool.isRequired,
|
||||
updateDirent: PropTypes.func.isRequired,
|
||||
showShareBtn: PropTypes.bool.isRequired,
|
||||
showDirentDetail: PropTypes.func.isRequired,
|
||||
onAddFolder: PropTypes.func.isRequired,
|
||||
onFileTagChanged: PropTypes.func,
|
||||
@@ -72,7 +71,6 @@ class DirGridView extends React.Component {
|
||||
onItemCopy={this.props.onItemCopy}
|
||||
isDirentListLoading={this.props.isDirentListLoading}
|
||||
updateDirent={this.props.updateDirent}
|
||||
showShareBtn={this.props.showShareBtn}
|
||||
onRenameNode={this.props.onRenameNode}
|
||||
showDirentDetail={this.props.showDirentDetail}
|
||||
onGridItemClick={this.props.onGridItemClick}
|
||||
|
@@ -17,7 +17,6 @@ const propTypes = {
|
||||
updateUsedRepoTags: PropTypes.func.isRequired,
|
||||
isDirentListLoading: PropTypes.bool.isRequired,
|
||||
direntList: PropTypes.array.isRequired,
|
||||
showShareBtn: PropTypes.bool.isRequired,
|
||||
sortBy: PropTypes.string.isRequired,
|
||||
sortOrder: PropTypes.string.isRequired,
|
||||
sortItems: PropTypes.func.isRequired,
|
||||
@@ -75,7 +74,6 @@ class DirListView extends React.Component {
|
||||
isGroupOwnedRepo={this.props.isGroupOwnedRepo}
|
||||
enableDirPrivateShare={this.props.enableDirPrivateShare}
|
||||
direntList={this.props.direntList}
|
||||
showShareBtn={this.props.showShareBtn}
|
||||
sortBy={this.props.sortBy}
|
||||
sortOrder={this.props.sortOrder}
|
||||
sortItems={this.props.sortItems}
|
||||
|
@@ -34,7 +34,6 @@ const propTypes = {
|
||||
onItemClick: PropTypes.func.isRequired,
|
||||
isDirentListLoading: PropTypes.bool.isRequired,
|
||||
isGroupOwnedRepo: PropTypes.bool.isRequired,
|
||||
showShareBtn: PropTypes.bool.isRequired,
|
||||
enableDirPrivateShare: PropTypes.bool.isRequired,
|
||||
updateDirent: PropTypes.func.isRequired,
|
||||
isDirentDetailShow: PropTypes.bool.isRequired,
|
||||
@@ -407,12 +406,15 @@ class DirentGridView extends React.Component{
|
||||
|
||||
let type = dirent.type;
|
||||
let permission = dirent.permission;
|
||||
|
||||
let showShareBtn = Utils.isHasPermissionToShare(currentRepoInfo, permission, dirent);
|
||||
let menuList = [];
|
||||
let contextmenuList = [];
|
||||
if (isContextmenu) {
|
||||
let { SHARE, DOWNLOAD, DELETE } = TextTranslation;
|
||||
contextmenuList = this.props.showShareBtn ? [SHARE] : [];
|
||||
|
||||
if (showShareBtn) {
|
||||
contextmenuList = [SHARE];
|
||||
}
|
||||
|
||||
if (dirent.permission === 'rw' || dirent.permission === 'r') {
|
||||
contextmenuList = [...contextmenuList, DOWNLOAD];
|
||||
|
@@ -22,7 +22,6 @@ const propTypes = {
|
||||
path: PropTypes.string.isRequired,
|
||||
repoID: PropTypes.string.isRequired,
|
||||
isItemFreezed: PropTypes.bool.isRequired,
|
||||
showShareBtn: PropTypes.bool.isRequired,
|
||||
dirent: PropTypes.object.isRequired,
|
||||
onItemClick: PropTypes.func.isRequired,
|
||||
freezeItem: PropTypes.func.isRequired,
|
||||
@@ -458,10 +457,11 @@ class DirentListItem extends React.Component {
|
||||
}
|
||||
|
||||
renderItemOperation = () => {
|
||||
let { dirent, selectedDirentList, currentRepoInfo, showShareBtn } = this.props;
|
||||
let { dirent, selectedDirentList, currentRepoInfo } = this.props;
|
||||
if (currentRepoInfo.permission === 'cloud-edit' || currentRepoInfo.permission === 'preview') {
|
||||
return '';
|
||||
}
|
||||
let showShareBtn = Utils.isHasPermissionToShare(currentRepoInfo, dirent.permission, dirent);
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
|
@@ -25,7 +25,6 @@ const propTypes = {
|
||||
isAllItemSelected: PropTypes.bool.isRequired,
|
||||
isDirentListLoading: PropTypes.bool.isRequired,
|
||||
direntList: PropTypes.array.isRequired,
|
||||
showShareBtn: PropTypes.bool.isRequired,
|
||||
sortBy: PropTypes.string.isRequired,
|
||||
sortOrder: PropTypes.string.isRequired,
|
||||
sortItems: PropTypes.func.isRequired,
|
||||
@@ -468,13 +467,17 @@ class DirentListView extends React.Component {
|
||||
|
||||
let type = dirent.type;
|
||||
let permission = dirent.permission;
|
||||
let showShareBtn = Utils.isHasPermissionToShare(currentRepoInfo, permission, dirent);
|
||||
|
||||
let menuList = [];
|
||||
let contextmenuList = [];
|
||||
|
||||
if (isContextmenu) {
|
||||
let { SHARE, DOWNLOAD, DELETE } = TextTranslation;
|
||||
contextmenuList = this.props.showShareBtn ? [SHARE] : [];
|
||||
|
||||
if (showShareBtn) {
|
||||
contextmenuList = [SHARE];
|
||||
}
|
||||
|
||||
if (dirent.permission === 'rw' || dirent.permission === 'r') {
|
||||
contextmenuList = [...contextmenuList, DOWNLOAD];
|
||||
@@ -485,14 +488,15 @@ class DirentListView extends React.Component {
|
||||
}
|
||||
|
||||
contextmenuList = [...contextmenuList, 'Divider'];
|
||||
|
||||
}
|
||||
|
||||
let { RENAME, MOVE, COPY, PERMISSION, OPEN_VIA_CLIENT, LOCK, UNLOCK, COMMENT, HISTORY, ACCESS_LOG, TAGS } = TextTranslation;
|
||||
if (type === 'dir' && permission === 'rw') {
|
||||
if (can_set_folder_perm) {
|
||||
menuList = [...menuList, RENAME, MOVE, COPY, 'Divider', PERMISSION, 'Divider', OPEN_VIA_CLIENT];
|
||||
menuList = [...contextmenuList, RENAME, MOVE, COPY, 'Divider', PERMISSION, 'Divider', OPEN_VIA_CLIENT];
|
||||
} else {
|
||||
menuList = [...menuList, RENAME, MOVE, COPY, 'Divider', OPEN_VIA_CLIENT];
|
||||
menuList = [...contextmenuList, RENAME, MOVE, COPY, 'Divider', OPEN_VIA_CLIENT];
|
||||
}
|
||||
return menuList;
|
||||
}
|
||||
@@ -659,7 +663,6 @@ class DirentListView extends React.Component {
|
||||
repoEncrypted={this.repoEncrypted}
|
||||
enableDirPrivateShare={this.props.enableDirPrivateShare}
|
||||
isGroupOwnedRepo={this.props.isGroupOwnedRepo}
|
||||
showShareBtn={this.props.showShareBtn}
|
||||
onItemClick={this.props.onItemClick}
|
||||
onItemRenameToggle={this.onItemRenameToggle}
|
||||
onItemSelected={this.onItemSelected}
|
||||
|
@@ -32,7 +32,6 @@ const propTypes = {
|
||||
onFilesTagChanged: PropTypes.func.isRequired,
|
||||
unSelectDirent: PropTypes.func.isRequired,
|
||||
updateDirent: PropTypes.func.isRequired,
|
||||
showShareBtn: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
class MutipleDirOperationToolbar extends React.Component {
|
||||
@@ -90,18 +89,19 @@ class MutipleDirOperationToolbar extends React.Component {
|
||||
getDirentMenuList = (dirent) => {
|
||||
let menuList = [];
|
||||
let currentRepoInfo = this.props.currentRepoInfo;
|
||||
let showShareBtn = Utils.isHasPermissionToShare(currentRepoInfo, dirent.permission, dirent);
|
||||
|
||||
const { SHARE, TAGS, RELATED_FILES, HISTORY, ACCESS_LOG, OPEN_VIA_CLIENT, LOCK, UNLOCK } = TextTranslation;
|
||||
|
||||
|
||||
if (dirent.type === 'dir') {
|
||||
let shareBtn = this.props.showShareBtn ? [SHARE] : [];
|
||||
menuList = [...shareBtn];
|
||||
if (showShareBtn) {
|
||||
menuList = [SHARE];
|
||||
}
|
||||
return menuList;
|
||||
}
|
||||
|
||||
if (dirent.type === 'file') {
|
||||
let shareBtn = (this.props.showShareBtn && canGenerateShareLink) ? [SHARE] : [];
|
||||
let shareBtn = showShareBtn ? [SHARE] : [];
|
||||
|
||||
menuList = [...shareBtn, TAGS, RELATED_FILES, 'Divider', HISTORY, ACCESS_LOG, 'Divider', OPEN_VIA_CLIENT];
|
||||
if (!Utils.isMarkdownFile(dirent.name)) {
|
||||
|
Reference in New Issue
Block a user