diff --git a/frontend/src/components/dirent-list-view/dirent-list-item.js b/frontend/src/components/dirent-list-view/dirent-list-item.js
index 6422eea1f6..65f5c93fba 100644
--- a/frontend/src/components/dirent-list-view/dirent-list-item.js
+++ b/frontend/src/components/dirent-list-view/dirent-list-item.js
@@ -307,9 +307,7 @@ class DirentListItem extends React.Component {
this.props.onItemDelete(this.state.dirent);
};
- onItemShare = (e) => {
- e.preventDefault();
- e.nativeEvent.stopImmediatePropagation(); // for document event
+ onItemShare = () => {
this.setState({ isShareDialogShow: !this.state.isShareDialogShow });
};
@@ -344,7 +342,7 @@ class DirentListItem extends React.Component {
this.onItemDownload(event);
break;
case 'Share':
- this.onItemShare(event);
+ this.onItemShare();
break;
case 'Delete':
this.onItemDelete(event);
@@ -723,7 +721,7 @@ class DirentListItem extends React.Component {
};
renderItemOperation = () => {
- let { currentRepoInfo, selectedDirentList } = this.props;
+ let { selectedDirentList } = this.props;
let dirent = this.state.dirent;
let canDownload = true;
let canDelete = true;
@@ -734,9 +732,6 @@ class DirentListItem extends React.Component {
canDelete = permission.delete;
}
- // https://dev.seafile.com/seahub/lib/d6f300e7-bb2b-4722-b83e-cf45e370bfbc/file/seaf-server%20%E5%8A%9F%E8%83%BD%E8%AE%BE%E8%AE%A1/%E6%9D%83%E9%99%90%E7%9B%B8%E5%85%B3/%E8%B5%84%E6%96%99%E5%BA%93%E6%9D%83%E9%99%90%E8%A7%84%E8%8C%83.md
- let showShareBtn = Utils.isHasPermissionToShare(currentRepoInfo, dirent.permission, dirent);
-
return (
<>
{selectedDirentList.length > 1 ?
@@ -746,9 +741,6 @@ class DirentListItem extends React.Component {
{(dirent.permission === 'rw' || dirent.permission === 'r' || (isCustomPermission && canDownload)) && (
)}
- {showShareBtn && (
-
- )}
{(dirent.permission === 'rw' || dirent.permission === 'cloud-edit' || (isCustomPermission && canDelete)) && (
)}
@@ -769,9 +761,6 @@ class DirentListItem extends React.Component {
{(dirent.permission === 'rw' || dirent.permission === 'r' || (isCustomPermission && canDownload)) && (
)}
- {showShareBtn && (
-
- )}
{(dirent.permission === 'rw' || dirent.permission === 'cloud-edit' || (isCustomPermission && canDelete)) && (
)}
diff --git a/frontend/src/utils/utils.js b/frontend/src/utils/utils.js
index 3319cb0f2d..7bb75360ed 100644
--- a/frontend/src/utils/utils.js
+++ b/frontend/src/utils/utils.js
@@ -494,10 +494,6 @@ export const Utils = {
list.push(DOWNLOAD);
}
- if (Utils.isHasPermissionToShare(currentRepoInfo, permission, dirent)) {
- list.push(SHARE);
- }
-
if (permission == 'rw' || permission == 'cloud-edit') {
list.push(DELETE, 'Divider');
}
@@ -507,6 +503,10 @@ export const Utils = {
}
}
+ if (Utils.isHasPermissionToShare(currentRepoInfo, permission, dirent)) {
+ list.push(SHARE);
+ }
+
if (permission == 'rw' || permission == 'cloud-edit') {
list.push(RENAME, MOVE);
}
@@ -561,10 +561,6 @@ export const Utils = {
list.push(DOWNLOAD);
}
- if (Utils.isHasPermissionToShare(currentRepoInfo, permission, dirent)) {
- list.push(SHARE);
- }
-
if (permission == 'rw' || permission == 'cloud-edit') {
if (!dirent.is_locked || (dirent.is_locked && dirent.locked_by_me)) {
list.push(DELETE);
@@ -580,6 +576,10 @@ export const Utils = {
}
}
+ if (Utils.isHasPermissionToShare(currentRepoInfo, permission, dirent)) {
+ list.push(SHARE);
+ }
+
if (permission == 'rw' || permission == 'cloud-edit') {
if (!dirent.is_locked || (dirent.is_locked && dirent.locked_by_me)) {
list.push(RENAME, MOVE);