Skip to content

Open-source and local-first Slack and Notion alternative that puts you in control of your data

Fix a case for sending changes when a new workspace/user is created

Hakan Shehuf952278271bc
diff --git a/apps/server/src/services/synapse.ts b/apps/server/src/services/synapse.ts
index 3e49367d..dd437408 100644
--- a/apps/server/src/services/synapse.ts
+++ b/apps/server/src/services/synapse.ts
@@ -226,18 +226,6 @@ class SynapseService {
const idType = getIdType(data.nodeId);
if (idType === IdType.User) {
await this.addNewWorkspaceUser(data.nodeId, data.workspaceId);
- } else if (idType === IdType.Workspace) {
- const userDevices = this.getWorkspaceUserDevices(data.workspaceId);
- for (const deviceIds of userDevices.values()) {
- for (const deviceId of deviceIds) {
- const socketConnection = this.connections.get(deviceId);
- if (!socketConnection) {
- continue;
- }
-
- this.sendPendingChangesDebounced(socketConnection);
- }
- }
}
await this.broadcastNodeChange(data);
@@ -263,6 +251,11 @@ class SynapseService {
)
.execute();
+ this.logger.trace(
+ userNodes,
+ `User nodes for ${data.nodeId} with ${userNodes.length} users`
+ );
+
if (userNodes.length === 0) {
return;
}
@@ -546,6 +539,8 @@ class SynapseService {
workspaceId,
userId,
});
+
+ this.sendPendingChangesDebounced(connection);
}
}