1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-05 08:53:14 +00:00

Improve current folder updated notification (#2704)

This commit is contained in:
王健辉
2018-12-25 10:25:08 +08:00
committed by Daniel Pan
parent a180723baa
commit fbc9f2a9de
2 changed files with 20 additions and 2 deletions

View File

@@ -53,6 +53,7 @@ class Wiki extends Component {
};
window.onpopstate = this.onpopstate;
this.hash = '';
this.lastModifyTime = new Date();
}
componentWillMount() {
@@ -87,7 +88,15 @@ class Wiki extends Component {
collabServer.unwatchRepo(repoID);
}
componentDidUpdate() {
this.lastModifyTime = new Date();
}
onRepoUpdateEvent = () => {
let currentTime = new Date();
if ((parseFloat(currentTime - this.lastModifyTime)/1000) <= 5) {
return;
}
let { path, dirID } = this.state;
seafileAPI.dirMetaData(repoID, path).then((res) => {
if (res.data.id !== dirID) {
@@ -96,7 +105,7 @@ class Wiki extends Component {
{gettext('This folder has been updated. ')}
<a href='' >{gettext('Refresh')}</a>
</span>,
{duration: 3600}
{id: 'repo_updated', duration: 3600}
);
}
})