1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-05 17:02:47 +00:00

Folder shared out (#5601)

* show if folder has been shared out

* [dir view] use special folder icon to identify folders which are shared out

* [dir view] improvement: in a library, make only one request to get the data of folders shared out

---------

Co-authored-by: llj <lingjun.li1@gmail.com>
This commit is contained in:
lian
2023-11-15 17:01:50 +08:00
committed by GitHub
parent 4e5c6fa98a
commit a9c3a6638c
5 changed files with 37 additions and 3 deletions

View File

@@ -492,6 +492,22 @@ class LibContentView extends React.Component {
if (!this.state.repoEncrypted && direntList.length) {
this.getThumbnails(repoID, path, this.state.direntList);
}
if (this.state.currentRepoInfo.is_admin) {
if (this.foldersSharedOut) {
this.identifyFoldersSharedOut();
} else {
this.foldersSharedOut = [];
seafileAPI.getAllRepoFolderShareInfo(repoID).then(res => {
res.data.share_info_list.forEach(item => {
if (this.foldersSharedOut.indexOf(item.path) === -1) {
this.foldersSharedOut.push(item.path);
}
});
this.identifyFoldersSharedOut();
});
}
}
}).catch((err) => {
Utils.getErrorMsg(err, true);
if (err.response && err.response.status === 403) {
@@ -505,6 +521,21 @@ class LibContentView extends React.Component {
});
};
identifyFoldersSharedOut = () => {
const { path, direntList } = this.state;
if (this.foldersSharedOut.length == 0) {
return;
}
direntList.forEach(dirent => {
if (dirent.type == 'dir' && this.foldersSharedOut.indexOf(Utils.joinPath(path, dirent.name) + '/') !== -1) {
dirent.has_been_shared_out = true;
}
});
this.setState({
direntList: direntList
});
};
onListContainerScroll = () => {
let itemsShowLength = this.state.itemsShowLength + 100;
this.setState({itemsShowLength: itemsShowLength});