mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-21 08:25:21 +00:00
Update lib-content-view.js
This commit is contained in:
parent
524002ae62
commit
a61d72cc7a
@ -163,6 +163,17 @@ class LibContentView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMessageCallback = (data) => {
|
onMessageCallback = (data) => {
|
||||||
|
/**
|
||||||
|
* data structure:
|
||||||
|
* {
|
||||||
|
* type: 'file-lock-changed',
|
||||||
|
* content: {
|
||||||
|
* path: '/1/2/a.sdoc',
|
||||||
|
* change_event: 'locked',
|
||||||
|
* expire: -1
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
if (data.type === 'file-lock-changed') {
|
if (data.type === 'file-lock-changed') {
|
||||||
const getStandardizedPath = (path) => {
|
const getStandardizedPath = (path) => {
|
||||||
return path.replace(/^\/+/, '');
|
return path.replace(/^\/+/, '');
|
||||||
@ -177,11 +188,11 @@ class LibContentView extends React.Component {
|
|||||||
return lastSlashIndex === -1 ? '' : path.slice(0, lastSlashIndex);
|
return lastSlashIndex === -1 ? '' : path.slice(0, lastSlashIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
let dirRouter = this.state.path;
|
let dirPath = this.state.path;
|
||||||
dirRouter = dirRouter.slice(1);
|
dirPath = dirPath.slice(1);
|
||||||
const notifRouter = getNotificationPath(data);
|
const notifPath = getNotificationPath(data);
|
||||||
|
|
||||||
if (dirRouter === notifRouter) {
|
if (dirPath === notifPath) {
|
||||||
const dirent = { name: data.content.path.split('/').pop() };
|
const dirent = { name: data.content.path.split('/').pop() };
|
||||||
if (data.content.change_event === 'locked') {
|
if (data.content.change_event === 'locked') {
|
||||||
if (data.content.expire === -1) {
|
if (data.content.expire === -1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user