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