mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 10:50:24 +00:00
modify collab server
This commit is contained in:
@@ -63,6 +63,7 @@ class Wiki extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
collabServer.watchRepo(repoID, this.onRepoUpdateEvent);
|
||||
seafileAPI.getRepoInfo(repoID).then(res => {
|
||||
this.setState({
|
||||
libNeedDecrypt: res.data.lib_need_decrypt,
|
||||
@@ -82,6 +83,24 @@ class Wiki extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
collabServer.unwatchRepo(repoID);
|
||||
}
|
||||
|
||||
onRepoUpdateEvent = () => {
|
||||
let { path, dirID } = this.state;
|
||||
seafileAPI.dirMetaData(repoID, path).then((res) => {
|
||||
if (res.data.id !== dirID) {
|
||||
toaster.notify(
|
||||
<span>
|
||||
{gettext('This folder has been updated. ')}
|
||||
<a href='' >{gettext('Refresh')}</a>
|
||||
</span>,
|
||||
{duration: 3600}
|
||||
);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
deleteItemAjaxCallback(path, isDir) {
|
||||
let node = this.state.treeData.getNodeByPath(path);
|
||||
@@ -282,7 +301,6 @@ class Wiki extends Component {
|
||||
isDirentListLoading: false,
|
||||
dirID: res.headers.oid,
|
||||
});
|
||||
collabServer.watchRepo(repoID, this.state.path, this.state.dirID);
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user