mirror of
https://github.com/colanode/colanode.git
synced 2025-12-29 00:25:03 +01:00
Fix user node sync
This commit is contained in:
@@ -7,8 +7,8 @@ import {
|
||||
LocalCreateNodeChangeData,
|
||||
LocalDeleteNodeChangeData,
|
||||
LocalNodeChangeData,
|
||||
LocalNodeUserStateChangeData,
|
||||
LocalUpdateNodeChangeData,
|
||||
LocalUserNodeChangeData,
|
||||
ServerSyncChangeResult,
|
||||
SyncLocalChangeResult,
|
||||
SyncLocalChangesInput,
|
||||
@@ -103,8 +103,8 @@ const handleLocalChange = async (
|
||||
case 'node_delete': {
|
||||
return handleDeleteNodeChange(workspaceUser, changeData);
|
||||
}
|
||||
case 'node_user_state_update': {
|
||||
return handleNodeUserStateChange(workspaceUser, changeData);
|
||||
case 'user_node_update': {
|
||||
return handleUserNodeStateChange(workspaceUser, changeData);
|
||||
}
|
||||
default: {
|
||||
return {
|
||||
@@ -304,9 +304,9 @@ const handleDeleteNodeChange = async (
|
||||
};
|
||||
};
|
||||
|
||||
const handleNodeUserStateChange = async (
|
||||
const handleUserNodeStateChange = async (
|
||||
workspaceUser: SelectWorkspaceUser,
|
||||
changeData: LocalNodeUserStateChangeData,
|
||||
changeData: LocalUserNodeChangeData,
|
||||
): Promise<SyncLocalChangeResult> => {
|
||||
if (workspaceUser.id !== changeData.userId) {
|
||||
return {
|
||||
|
||||
@@ -44,8 +44,8 @@ export type LocalDeleteNodeChangeData = {
|
||||
deletedBy: string;
|
||||
};
|
||||
|
||||
export type LocalNodeUserStateChangeData = {
|
||||
type: 'node_user_state_update';
|
||||
export type LocalUserNodeChangeData = {
|
||||
type: 'user_node_update';
|
||||
nodeId: string;
|
||||
userId: string;
|
||||
lastSeenVersionId: string;
|
||||
@@ -58,4 +58,4 @@ export type LocalNodeChangeData =
|
||||
| LocalCreateNodeChangeData
|
||||
| LocalUpdateNodeChangeData
|
||||
| LocalDeleteNodeChangeData
|
||||
| LocalNodeUserStateChangeData;
|
||||
| LocalUserNodeChangeData;
|
||||
|
||||
Reference in New Issue
Block a user