fix: collections.create event not propagated when initialized with private permissions
This commit is contained in:
@@ -5,6 +5,7 @@ import { observer } from "mobx-react";
|
||||
import * as React from "react";
|
||||
import { io, Socket } from "socket.io-client";
|
||||
import RootStore from "~/stores/RootStore";
|
||||
import Collection from "~/models/Collection";
|
||||
import Document from "~/models/Document";
|
||||
import FileOperation from "~/models/FileOperation";
|
||||
import Pin from "~/models/Pin";
|
||||
@@ -267,6 +268,10 @@ class SocketProvider extends React.Component<Props> {
|
||||
groups.remove(event.modelId);
|
||||
});
|
||||
|
||||
this.socket.on("collections.create", (event: PartialWithId<Collection>) => {
|
||||
collections.add(event);
|
||||
});
|
||||
|
||||
this.socket.on(
|
||||
"collections.delete",
|
||||
(event: WebsocketEntityDeletedEvent) => {
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
Team,
|
||||
} from "@server/models";
|
||||
import {
|
||||
presentCollection,
|
||||
presentDocument,
|
||||
presentFileOperation,
|
||||
presentPin,
|
||||
@@ -177,22 +178,15 @@ export default class WebsocketsProcessor {
|
||||
.to(
|
||||
collection.permission
|
||||
? `team-${collection.teamId}`
|
||||
: `collection-${collection.id}`
|
||||
: `user-${collection.createdById}`
|
||||
)
|
||||
.emit("entities", {
|
||||
event: event.name,
|
||||
collectionIds: [
|
||||
{
|
||||
id: collection.id,
|
||||
updatedAt: collection.updatedAt,
|
||||
},
|
||||
],
|
||||
});
|
||||
.emit(event.name, presentCollection(collection));
|
||||
|
||||
return socketio
|
||||
.to(
|
||||
collection.permission
|
||||
? `team-${collection.teamId}`
|
||||
: `collection-${collection.id}`
|
||||
: `user-${collection.createdById}`
|
||||
)
|
||||
.emit("join", {
|
||||
event: event.name,
|
||||
|
||||
Reference in New Issue
Block a user