Skip to content

Commit

Permalink
optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
孙永强 committed Nov 25, 2024
1 parent 71a55c2 commit 29ecca8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 3 additions & 6 deletions frontend/src/pages/lib-content-view/lib-content-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,12 @@ class LibContentView extends React.Component {
if (data.content.change_event === 'locked') {
if (data.content.expire === -1) {
this.updateDirent(dirent, 'is_freezed', true);
this.updateDirent(dirent, 'is_locked', true);
this.updateDirent(dirent, 'locked_by_me', true);
this.updateDirent(dirent, 'lock_owner_name', data.content.lock_user[0]);
} else {
this.updateDirent(dirent, 'is_freezed', false);
this.updateDirent(dirent, 'is_locked', true);
this.updateDirent(dirent, 'locked_by_me', false);
this.updateDirent(dirent, 'lock_owner_name', data.content.lock_user[0]);
}
this.updateDirent(dirent, 'is_locked', true);
this.updateDirent(dirent, 'locked_by_me', true);
this.updateDirent(dirent, 'lock_owner_name', data.content.lock_user[0]);
} else if (data.content.change_event === 'unlocked') {
this.updateDirent(dirent, 'is_locked', false);
this.updateDirent(dirent, 'locked_by_me', false);
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/utils/websocket-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ class WebSocketClient {
this.socket = null;
this.shouldReconnect = true;
this.onMessageCallback = onMessageCallback;
this.connect();
if (notificationServerUrl !== '') {
this.connect();
}
}

async connect() {
Expand Down

0 comments on commit 29ecca8

Please sign in to comment.